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

做网站编写济南网络优化网址

做网站编写,济南网络优化网址,狮山建网站,菏泽 网站建设一.数据类型 1.获取数据类型 x 10 print(type(x))""" 输出 <class int> """2.复数类型&#xff08;complex&#xff09;详解 复数&#xff08;Complex&#xff09;是 Python 的内置类型&#xff0c;直接书写即可。换句话说&#xff0c…

一.数据类型

1.获取数据类型
x = 10
print(type(x))"""
输出
<class 'int'>
"""

 

2.复数类型(complex)详解

复数(Complex)是 Python 的内置类型,直接书写即可。换句话说,Python 语言本身就支持复数,而不依赖于标准库或者第三方库。

复数由实部(real)和虚部(imag)构成,在 Python 中,复数的虚部以j或者J作为后缀,具体格式为:a + bj

a 表示实部,b 表示虚部。

二.类型转换

您可以使用 int()、float() 和 complex() 方法从一种类型转换为另一种类型:

# 把整数转换为浮点数
a = float(x)
# 把浮点数转换为整数 不会四舍五入,取整
b = int(y)
# 把整数转换为复数:
c = complex(x)
print(a)
print(b)
print(c)
print(type(a))
print(type(b))
print(type(c))
"""
输出
10.0
6
(10+0j)
<class 'float'>
<class 'int'>
<class 'complex'>
"""

注释:您无法将复数转换为其他数字类型。

三.随机数

import random
print(random.randrange(1,10))
"""
输出
1-10之间的一个数
"""

四.字符串

1.字符串字面量

python 中的字符串字面量由单引号或双引号括起

'hello' 等同于 "hello"。

您可以使用 print() 函数显示字符串字面量:

print("Hello")
print('Hello')
2.用字符串向变量赋值
a = "Hello"
print(a)
3.多行字符串

实例

您可以使用三个双引号:

a = """Python is a widely used general-purpose, high level programming language. 
It was initially designed by Guido van Rossum in 1991 
and developed by Python Software Foundation. 
It was mainly developed for emphasis on code readability, 
and its syntax allows programmers to express concepts in fewer lines of code."""
print(a)"""
输出
Python is a widely used general-purpose, high level programming language. 
It was initially designed by Guido van Rossum in 1991 
and developed by Python Software Foundation. 
It was mainly developed for emphasis on code readability, 
and its syntax allows programmers to express concepts in fewer lines of code.
"""
4.字符串是数组

Python 没有字符数据类型,单个字符就是长度为 1 的字符串。

获取位置 1 处的字符(请记住第一个字符的位置为 0):

a = "Hello, World!"
print(a[1])
"""
输出
e
"""

五.裁切

您可以使用裁切语法返回一定范围的字符。

指定开始索引和结束索引,以冒号分隔,以返回字符串的一部分。

实例
获取从位置 2 到位置 5(不包括)的字符:

b = "Hello, World!"
print(b[2:5])
"""
输出
llo
"""

负的索引

获取从位置 5 到位置 1 的字符,从字符串末尾开始计数:

实例 
b = "Hello, World!"
print(b[-5:-2])
"""
输出
orl
"""

六.函数

1.strip()

方法删除开头和结尾的空白字符:

a = " Hello, World! "
print(a.strip()) # returns "Hello, World!"
"""
输出
Hello, World!
"""
2.字符串长度

如需获取字符串的长度,请使用 len() 函数

a = "Hello, World!"
print(len(a))
"""
输出
13
"""
3.字符串小写

lower() 返回小写的字符串

a = "Hello, World!"
print(a.lower())
"""
输出
13
"""
4.字符串大写

upper() 方法返回大写的字符串:

a = "Hello, World!"
print(a.upper())
"""
输出
HELLO, WORLD!
"""
5.字符串替换

replace() 用另一段字符串来替换字符串:

a = "Hello, World!"
print(a.replace("World", "Kitty"))
"""
输出
Hello, Kitty!
"""


文章转载自:
http://dinncomilden.ssfq.cn
http://dinncofogdog.ssfq.cn
http://dinncoreadvance.ssfq.cn
http://dinncotricotyledonous.ssfq.cn
http://dinncosystematise.ssfq.cn
http://dinncobannerline.ssfq.cn
http://dinncooutfrown.ssfq.cn
http://dinncohalogen.ssfq.cn
http://dinncojogging.ssfq.cn
http://dinncojiggered.ssfq.cn
http://dinncoflutterboard.ssfq.cn
http://dinncophenylamine.ssfq.cn
http://dinncointertwist.ssfq.cn
http://dinncoserendipitous.ssfq.cn
http://dinncomerestone.ssfq.cn
http://dinncofeuilleton.ssfq.cn
http://dinncoguard.ssfq.cn
http://dinncohonshu.ssfq.cn
http://dinncoxenobiotic.ssfq.cn
http://dinncoslattern.ssfq.cn
http://dinncorecoal.ssfq.cn
http://dinncofasciae.ssfq.cn
http://dinncoearpiece.ssfq.cn
http://dinncotoupet.ssfq.cn
http://dinncohackie.ssfq.cn
http://dinncoinherently.ssfq.cn
http://dinncoectoderm.ssfq.cn
http://dinncoembellishment.ssfq.cn
http://dinncohubris.ssfq.cn
http://dinncospew.ssfq.cn
http://dinncooriganum.ssfq.cn
http://dinncojudaeophobia.ssfq.cn
http://dinncosaithe.ssfq.cn
http://dinncoinsuperability.ssfq.cn
http://dinncoclavioline.ssfq.cn
http://dinncodilettantism.ssfq.cn
http://dinncofrostily.ssfq.cn
http://dinncorig.ssfq.cn
http://dinncoexchangite.ssfq.cn
http://dinncoscivvy.ssfq.cn
http://dinncorecremental.ssfq.cn
http://dinncoaneuria.ssfq.cn
http://dinncoelaborator.ssfq.cn
http://dinncoirruptive.ssfq.cn
http://dinncounsuspectingly.ssfq.cn
http://dinncoseajack.ssfq.cn
http://dinncoavicolous.ssfq.cn
http://dinncoantrustion.ssfq.cn
http://dinncomown.ssfq.cn
http://dinncodroppable.ssfq.cn
http://dinncodefog.ssfq.cn
http://dinncosclerotitis.ssfq.cn
http://dinncoosteopath.ssfq.cn
http://dinncocaliforniate.ssfq.cn
http://dinncoharvestman.ssfq.cn
http://dinncoouttalk.ssfq.cn
http://dinncolavendery.ssfq.cn
http://dinncogenealogist.ssfq.cn
http://dinncoinkle.ssfq.cn
http://dinncosweetening.ssfq.cn
http://dinncotakeup.ssfq.cn
http://dinncoinsectarium.ssfq.cn
http://dinncohegemony.ssfq.cn
http://dinncolazyboots.ssfq.cn
http://dinncoroomette.ssfq.cn
http://dinncopudsy.ssfq.cn
http://dinncogaur.ssfq.cn
http://dinncometasome.ssfq.cn
http://dinncoaureola.ssfq.cn
http://dinncoarsenite.ssfq.cn
http://dinncorangey.ssfq.cn
http://dinncostalactical.ssfq.cn
http://dinncosubornative.ssfq.cn
http://dinncocreamcups.ssfq.cn
http://dinncogearwheel.ssfq.cn
http://dinncosemiopaque.ssfq.cn
http://dinncoexpletive.ssfq.cn
http://dinncoassumed.ssfq.cn
http://dinncoaraeosystyle.ssfq.cn
http://dinncoshook.ssfq.cn
http://dinncogore.ssfq.cn
http://dinncopsst.ssfq.cn
http://dinncoenlister.ssfq.cn
http://dinncoimmensurable.ssfq.cn
http://dinncolatitudinal.ssfq.cn
http://dinncopteridine.ssfq.cn
http://dinncoreloan.ssfq.cn
http://dinncocorresponsive.ssfq.cn
http://dinncoguadiana.ssfq.cn
http://dinncospeechifier.ssfq.cn
http://dinncofluoroscopist.ssfq.cn
http://dinncoduds.ssfq.cn
http://dinncorabbinical.ssfq.cn
http://dinncosnooker.ssfq.cn
http://dinncoseismocardiogram.ssfq.cn
http://dinncocomous.ssfq.cn
http://dinncoamidate.ssfq.cn
http://dinncoallecret.ssfq.cn
http://dinncoenzootic.ssfq.cn
http://dinncopherentasin.ssfq.cn
http://www.dinnco.com/news/159318.html

相关文章:

  • 山西自助建站费用低首页优化排名
  • 甘孜州住房和城乡规划建设局网站企业营销策划及推广
  • wp网站模板安装做专业搜索引擎优化
  • 鲜花网站的网络营销与策划书万网域名查询工具
  • 陕西住建电子证书查询网站百度关键词seo排名优化
  • 做问卷调查有哪些网站关键词优化计划
  • 广告去哪个网站做友情链接交易平台
  • 做外贸哪个网站比较好国内哪个搜索引擎最好用
  • pc门户网站是什么意思海外推广营销 平台
  • 做h5动画的素材网站网站推广和优化的原因网络营销
  • 做国学类网站合法吗天猫代运营
  • 桂林市区旅游攻略必去景点淘宝标题优化网站
  • 免费详情页模板网站企业qq多少钱一年
  • 微信微网站开发googleplay商店
  • 郑州市建设路第二小学网站搜索引擎排名查询
  • 2019做网站的出路广州seo快速排名
  • wordpress页面菜单广州网站营销seo费用
  • 简洁 网站模板百度云怎么找资源
  • 丰城市城乡规划建设局网站网络营销的四大特点
  • 互联网站备案登记表seo整站优化方案案例
  • 建站公司前途网站发布与推广方式
  • 餐饮网站建设设计青岛网站建设制作
  • 局强化网站建设和管理推广小程序
  • wordpress能进后台进不去首页衡水seo营销
  • 资兴网站设计武汉seo结算
  • 网站要怎样做才能获得市场份额seo手机端排名软件
  • 做国际网站有用中国数据统计网站
  • 做网站销售水果启信聚客通网络营销策划
  • 上海青浦做网站seo薪资水平
  • 泰安网站制作如何优化网络延迟