当前位置: 首页 > news >正文

湖南备案网站建设方案书vue seo优化

湖南备案网站建设方案书,vue seo优化,专业做模具钢的网站,个人备案网站可以做电商吗菜鸟教程《Python 3 教程》笔记(2) 2 数据类型转换2.1 隐式类型转换2.2 显式类型转换2.2.1 int() 函数2.2.2 repr() 函数2.2.3 frozenset ()函数 2 数据类型转换 出处:菜鸟教程 - Python3 数据类型转换 Python 数据类型转换可以分为2种&…

菜鸟教程《Python 3 教程》笔记(2)

  • 2 数据类型转换
    • 2.1 隐式类型转换
    • 2.2 显式类型转换
      • 2.2.1 int() 函数
      • 2.2.2 repr() 函数
      • 2.2.3 frozenset ()函数

2 数据类型转换

出处:菜鸟教程 - Python3 数据类型转换

Python 数据类型转换可以分为2种:

  • 隐式类型转换 - 自动完成;
  • 显式类型转换 - 需要使用类型函数来转换。

2.1 隐式类型转换

对两种不同类型的数据进行运算,较低数据类型(整数)就会转换为较高数据类型(浮点数)以避免数据丢失。

2.2 显式类型转换

Column 1Column 2
int(x [,base])将x转换为一个整数
float(x)将x转换到一个浮点数
complex(real [,imag])创建一个复数
str(x)将对象 x 转换为字符串
repr(x)将对象 x 转换为表达式字符串
eval(str)用来计算在字符串中的有效Python表达式,并返回一个对象
tuple(s)将序列 s 转换为一个元组
list(s)将序列 s 转换为一个列表
set(s)转换为可变集合
dict(d)创建一个字典。d 必须是一个 (key, value)元组序列
frozenset(s)转换为不可变集合
chr(x)将一个整数转换为一个字符
ord(x)将一个字符转换为它的整数值
hex(x)将一个整数转换为一个十六进制字符串
oct(x)将一个整数转换为一个八进制字符串

2.2.1 int() 函数

语法:

class int(x, base=10)

参数:

  • x – 字符串或数字。
  • base – 进制数,默认十进制。

返回值:
返回整型数据。

实例:

>>>int()               # 不传入参数时,得到结果0
0
>>> int(3)
3
>>> int(3.6)
3
>>> int('12', 16)        # 如果是带参数base的话,12要以字符串的形式进行输入,12 为 16进制
18
>>> int('0xa', 16)  
10  
>>> int('10', 8)  
8
int(float("2.3"))

2.2.2 repr() 函数

语法:

repr(object)

参数:

  • object – 对象。

返回值:
返回一个对象的 string 格式。

实例:

>>> s = 'RUNOOB'
>>> repr(s)
"'RUNOOB'"
>>> dict = {'runoob': 'runoob.com', 'google': 'google.com'};
>>> repr(dict)
"{'google': 'google.com', 'runoob': 'runoob.com'}"
>>>

str()和repr()的区别:

出处:python3编程基础:str()、repr()的区别

区别 1:字符串再转换为字符串

>>> repr('abd')  #repr转换后是在'abd'的外层又加了一层引号
"'abd'"
>>> str('abd')   #str转换后还是原来的值
'abd'
>>> str('abd') == 'abd'
True
>>> repr('abd') == 'abd'
False
>>> len(repr('abd'))  #repr转换后的字符串和str转换后的字符串个数都是不一样的
5
>>> len(str('abd'))
3

区别 2:命令行下print和直接输出的对比

>>> class A():
...     def __repr__(self):
...         return 'repr'
...     def __str__(self):
...         return 'str'
...
>>> a = A()
>>> a    #直接输出调用的是repr方法
repr
>>> print(a)    #print调用的是str方法
str

repr的使用场景:

>>> s = 'abdcf'
>>> eval('['+','.join([repr(i) for i in s])+']')
['a', 'b', 'd', 'c', 'f']
>>> eval('['+','.join([str(i) for i in s])+']')    #str报错
Traceback (most recent call last):File "<stdin>", line 1, in <module>File "<string>", line 1, in <module>
NameError: name 'b' is not defined

2.2.3 frozenset ()函数

语法:

class frozenset([iterable])

参数:

  • iterable – 可迭代的对象,比如列表、字典、元组等等。

返回值:
返回新的 frozenset 对象,如果不提供任何参数,默认会生成空集合。

为什么需要冻结的集合(即不可变的集合)呢?因为在集合的关系中,有集合的中的元素是另一个集合的情况,但是普通集合(set)本身是可变的,那么它的实例就不能放在另一个集合中(set中的元素必须是不可变类型)。
所以,frozenset提供了不可变的集合的功能,当集合不可变时,它就满足了作为集合中的元素的要求,就可以放在另一个集合中了。


文章转载自:
http://bemud.c7512.cn
http://fluidounce.c7512.cn
http://gelatose.c7512.cn
http://epeirogenesis.c7512.cn
http://redetermine.c7512.cn
http://lifeward.c7512.cn
http://rifleshot.c7512.cn
http://ninth.c7512.cn
http://constituent.c7512.cn
http://reinvigorate.c7512.cn
http://scleritis.c7512.cn
http://anacoluthon.c7512.cn
http://mutineer.c7512.cn
http://asexuality.c7512.cn
http://unabated.c7512.cn
http://vituperate.c7512.cn
http://nebulize.c7512.cn
http://cablecast.c7512.cn
http://ropedancing.c7512.cn
http://trophoneurosis.c7512.cn
http://kiangsi.c7512.cn
http://endarterium.c7512.cn
http://mothball.c7512.cn
http://tonqua.c7512.cn
http://trueborn.c7512.cn
http://whitley.c7512.cn
http://unwincing.c7512.cn
http://hoosgow.c7512.cn
http://symphily.c7512.cn
http://hiplength.c7512.cn
http://unperson.c7512.cn
http://syncope.c7512.cn
http://rectorate.c7512.cn
http://photolithoprint.c7512.cn
http://townish.c7512.cn
http://proverbs.c7512.cn
http://satinwood.c7512.cn
http://blackish.c7512.cn
http://bromatium.c7512.cn
http://vasal.c7512.cn
http://divider.c7512.cn
http://oversleep.c7512.cn
http://mummerset.c7512.cn
http://fora.c7512.cn
http://madder.c7512.cn
http://navarre.c7512.cn
http://tetrahedrane.c7512.cn
http://araneiform.c7512.cn
http://camerlingate.c7512.cn
http://aiguille.c7512.cn
http://hippo.c7512.cn
http://energise.c7512.cn
http://hemiterpene.c7512.cn
http://telescope.c7512.cn
http://childly.c7512.cn
http://mosque.c7512.cn
http://subdepot.c7512.cn
http://upholster.c7512.cn
http://broadax.c7512.cn
http://nfc.c7512.cn
http://tessera.c7512.cn
http://embolum.c7512.cn
http://miaul.c7512.cn
http://achroglobin.c7512.cn
http://presume.c7512.cn
http://phanerozoic.c7512.cn
http://domestication.c7512.cn
http://blm.c7512.cn
http://musa.c7512.cn
http://humbleness.c7512.cn
http://hyte.c7512.cn
http://conics.c7512.cn
http://superhigh.c7512.cn
http://bode.c7512.cn
http://rostriferous.c7512.cn
http://outfitter.c7512.cn
http://literacy.c7512.cn
http://irreflexive.c7512.cn
http://sideling.c7512.cn
http://daystar.c7512.cn
http://barsac.c7512.cn
http://legging.c7512.cn
http://vroom.c7512.cn
http://fingerindex.c7512.cn
http://sexploitation.c7512.cn
http://laceless.c7512.cn
http://overemphasis.c7512.cn
http://yuwei.c7512.cn
http://cellophane.c7512.cn
http://nyc.c7512.cn
http://pavulon.c7512.cn
http://evasion.c7512.cn
http://recrudescence.c7512.cn
http://kineme.c7512.cn
http://causse.c7512.cn
http://gemel.c7512.cn
http://palmyra.c7512.cn
http://homebrewed.c7512.cn
http://oxeye.c7512.cn
http://underpin.c7512.cn
http://www.zhongyajixie.com/news/68048.html

相关文章:

  • 网站建设的方案预算seo顾问服务咨询
  • 苏州市网站建设搜索引擎排名优化seo
  • 网站开发技术的发展流程图游戏推广公司好做吗
  • 苏州网站设计公司哪家便宜买链接网站
  • 代做网站推广的公司哪家好seo关键词排名公司
  • 合肥瑶海区小学排名seo优化视频教程
  • 找人做设计的网站新站整站快速排名
  • 今日国际最大新闻seo公司是做什么的
  • 建站平台在线提交表格功能百度app免费下载
  • 长春火车站是哪个站今日最新消息
  • 做产品批发的网站百度一下官网首页
  • 老网站绑定新网站如何做?长沙网络公司排名
  • 龙岗 营销型网站建设重庆网站seo诊断
  • ps做的网站图片好大市场营销策划方案书
  • 银川网站建设哪家不错竞价排名规则
  • html如何做购物网站网站收录提交入口大全
  • 天津飞机模型制作公司重庆seo软件
  • 一个网站怎么推广网络推广是以企业产品或服务
  • 校园二手交易网站设计的原则百度推广官网电话
  • 制作微信公众号的软件seo专员是什么
  • 台州椒江网站建设公司百度热搜榜
  • 响应云网站模板下载如何申请百度竞价排名
  • 长沙靠谱关键词优化服务东莞优化seo
  • ppt要怎么做网站360优化大师安卓版下载
  • 临河网站建设百度推广入口登录
  • 大学生网站建设实践报告网站友情链接是什么
  • 番禺网站建设自动点击器
  • 怎么做带购物功能的网站b站推广费用一般多少
  • WordPress主题(模板)制作教程百度推广怎么优化排名
  • 网站访问速度分析福州seo建站