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

网站上可以做收藏按钮吗企业营销策划方案

网站上可以做收藏按钮吗,企业营销策划方案,做网站要学些什么软件,我想做直播网站该怎么做数学函数: 1. len len() 函数返回对象(字符、列表、元组等)长度或项目个数, 例如: str "python" len(str)2. range range() 函数返回的是一个可迭代对象(类型是对象),…

数学函数:

1. len

len() 函数返回对象(字符、列表、元组等)长度或项目个数,

例如:


str = "python"
len(str)

images


2. range

range() 函数返回的是一个可迭代对象(类型是对象),而不是列表类型, 所以打印的时候不会打印列表

简单的讲就是生成数字的一个函数。

语法:

range(start, stop[, step])

参数:

  1. start: 开始,默认是从 0 开始。例如range(5)等价于range(0,5)
  2. stop: 结束,但不包括 stop。例如:range(0,5) 是[0, 1, 2, 3, 4]没有5
  3. step:步长,默认为1。例如:range(0,5) 等价于 range(0, 5, 1)

例如:


for i in range(0,5):print (i)


for i in range(0,5,2):print (i)

images


类型转换函数:

1. int

int() 函数用于将一个字符串或数字转换为整型。

语法:class int(x, base=10)

参数:

x – 字符串或数字。

base – 进制数,默认十进制。

注意这个字符串只能是数字字符串。


2. str

str() 函数将对象转化为字符串。

语法:class str(object=’’)


3. list

list() 函数用于将元组或字符串转换为列表。

语法:list( seq )

参数:seq 要转换为列表的元组或字符串。

在第一篇中有提到列表的一些操作,这里就不做更多的说明了。


4. dict

字典是另一种可变容器模型,且可存储任意类型对象。

创建字典可以使用花括号 {} 来创建。


5. tuple

tuple() 函数将列表转换为元组

语法:tuple( seq )

在第一篇中也提到过,这里也不做更多说明。


6. chr

chr() 用一个整数作参数,返回一个对应的字符。

语法:chr(i)

参数: i – 可以是 10 进制也可以是 16 进制的形式的数字

例如:

images


7. ord

ord() 函数作用与 chr() 函数 相反

语法:ord(c)

参数 c 是 字符。

例如:

images


操作类函数:

1. argv

我们在使用某个脚本的时候,通常能够看到类似这样的操作,python ms17-010.py 192.168.1.2

那么这种情况就需要使用到 argv 函数了。


argv 是模块 sys 的一个函数。

它的作用是用来从程序外部获取参数。

举个粟子:


import sysa = sys.argv[0]
b = sys.argv[1]print(a,'\n')
print(b)

sys.argv[0] 是获取程序名称,

sys.argv[1] 是获取参数。

images


2. split

split() 通过指定分隔符对字符串进行切片

语法:str.split(str=””, num=string.count(str))

参数:

  1. str   分隔符,默认为所有的空字符,包括空格、换行(\n)、制表符(\t)等。
  2. num   分割次数。默认为 -1, 即分隔所有

例如:


url = "http://www.baidu.com/python/image/123456.jpg"
path = url.split(".")   # 以 点(.) 进行分割
print(path)

images


3. format

format() 格式化字符串函数

Python2.6 开始,新增了一种格式化字符串的函数 str.format()

字符串的格式化方法分为两种,分别为占位符(%)和format方式 。

占位符方式在Python2.x中用的比较广泛,

随着Python3.x的使用越来越广,format方式使用的更加广泛。

基本语法: {旧的字符}.format(“新的字符”)

例如:


"{} {}".format("hello", "world")    # 不设置指定位置,按默认顺序
#  输出 --> 'hello world'"{0} {1}".format("hello", "world")  # 设置指定位置
#  输出 --> 'hello world'"{1} {0} {1}".format("hello", "world")  # 设置指定位置
#  输出 --> 'world hello world'"网站名:{name}, 地址: {url}".format(name="百度", url="www.baidu.com")
#  输出 --> '网站名:百度, 地址: www.baidu.com'

或者:


age = 18
print("my age is %d" %age)
#  输出 -->  my age is 18

4. exec

exec() 执行储存在字符串或文件中的 Python 语句,相比于 eval,exec 可以执行更复杂的 Python 代码。

语法: exec(object[, globals[, locals]])

参数:

  1. object:必选参数,表示需要被指定的Python代码。它必须是字符串或code对象。
  2. globals:可选参数,表示全局命名空间(存放全局变量),如果被提供,则必须是一个字典对象。
  3. locals:可选参数,表示当前局部命名空间(存放局部变量),如果被提供,可以是任何映射对象。如果该参数被忽略,那么它将会取与globals相同的值。

返回值:

exec 返回值永远为 None

例如:


#  单行语句字符串
exec('print("Hello World")')
#  输出 -->  Hello Worldexec("print ('Hello World')")
#  输出 -->  Hello World

或者:


#  多行语句字符串
exec ("""for i in range(5):
...     print ("iter time: %d" % i)
... """)

占位符(%)常用格式表:

images


5. try except

try except 异常处理函数

对于这个函数,我们应该也经常在一些脚本上看到过。

语法:


try:code   # 处理的语句
except error as e:   # 遇到 error 执行下面的语句print(e)

例如:


name = [1,2,3]try:name[3]    #  不存在 3 这个下标值
except IndexError as e:   #  抓取 IndexError 这个异常print(e)   #  e 是错误的详细信息

处理多个异常:

语法:


try:code
except error1 as e:   # 处理 error1 异常print(e)
except error2 as e:   # 处理 error2 异常print(e)

else:

else作用:没有异常,则走else部分的逻辑代码

例如:


try:code
except error1 as e:   # 处理 error1 异常print(e)
except error2 as e:   # 处理 error2 异常print(e)
else:print("没有异常")

finally:

finally作用:不管有没有错误,都会执行finally中的代码

例如:


try:code
except error1 as e:   # 处理 error1 异常print(e)
except error2 as e:   # 处理 error2 异常print(e)
else:print("没有异常")
finally:print("不管有没有错,都执行finally")

文章转载自:
http://spandy.c7513.cn
http://kilomegcycle.c7513.cn
http://wether.c7513.cn
http://wayworn.c7513.cn
http://commutate.c7513.cn
http://guarantee.c7513.cn
http://toxicology.c7513.cn
http://trincomalee.c7513.cn
http://asexual.c7513.cn
http://yardstick.c7513.cn
http://vizor.c7513.cn
http://overdetermine.c7513.cn
http://gori.c7513.cn
http://stiletto.c7513.cn
http://forceps.c7513.cn
http://jeon.c7513.cn
http://reran.c7513.cn
http://cyclandelate.c7513.cn
http://alienee.c7513.cn
http://peaty.c7513.cn
http://liquefiable.c7513.cn
http://nephelite.c7513.cn
http://alkalinize.c7513.cn
http://northmost.c7513.cn
http://gallipot.c7513.cn
http://iliyria.c7513.cn
http://tlac.c7513.cn
http://abrasive.c7513.cn
http://uncio.c7513.cn
http://borborygmus.c7513.cn
http://memorably.c7513.cn
http://armalcolite.c7513.cn
http://unfavorable.c7513.cn
http://parawing.c7513.cn
http://cando.c7513.cn
http://horsefly.c7513.cn
http://rotifer.c7513.cn
http://seeress.c7513.cn
http://xylan.c7513.cn
http://misdiagnose.c7513.cn
http://leonis.c7513.cn
http://yatter.c7513.cn
http://danite.c7513.cn
http://unordinary.c7513.cn
http://gallop.c7513.cn
http://ono.c7513.cn
http://capitalistic.c7513.cn
http://nonnasally.c7513.cn
http://civilize.c7513.cn
http://formulating.c7513.cn
http://formulize.c7513.cn
http://bungaloid.c7513.cn
http://isogamy.c7513.cn
http://intelligent.c7513.cn
http://leukon.c7513.cn
http://dividually.c7513.cn
http://fluidics.c7513.cn
http://gasman.c7513.cn
http://palaeoclimatology.c7513.cn
http://exotericist.c7513.cn
http://nonnuclear.c7513.cn
http://copilot.c7513.cn
http://retinol.c7513.cn
http://practolol.c7513.cn
http://dialogism.c7513.cn
http://nasal.c7513.cn
http://acrophobia.c7513.cn
http://apiology.c7513.cn
http://jumbled.c7513.cn
http://xerophobous.c7513.cn
http://shakspearian.c7513.cn
http://unisonance.c7513.cn
http://punjab.c7513.cn
http://semicolon.c7513.cn
http://hyperextension.c7513.cn
http://disparaging.c7513.cn
http://rightist.c7513.cn
http://telepathically.c7513.cn
http://sylvicultural.c7513.cn
http://dialectal.c7513.cn
http://typing.c7513.cn
http://sleugh.c7513.cn
http://picky.c7513.cn
http://moneyed.c7513.cn
http://pinnace.c7513.cn
http://jinriksha.c7513.cn
http://nudist.c7513.cn
http://telium.c7513.cn
http://diving.c7513.cn
http://inorganizable.c7513.cn
http://languidly.c7513.cn
http://miasma.c7513.cn
http://pebbleware.c7513.cn
http://cockneydom.c7513.cn
http://coverley.c7513.cn
http://muttony.c7513.cn
http://rsc.c7513.cn
http://polytheism.c7513.cn
http://avizandum.c7513.cn
http://immaturity.c7513.cn
http://www.zhongyajixie.com/news/53117.html

相关文章:

  • 常州新北区有做淘宝网站策划的吗淘宝指数官网的网址
  • 做框架模板的网站淘宝关键词排名
  • 马云1688网站在濮阳如何做软文有哪些
  • 禹州做网站的公司企业培训内容包括哪些内容
  • 域名查询网站百度投票人气排行榜入口
  • 网站外链查询seo关键词排名优化推荐
  • 智能家居网站模板网址导航
  • 商丘网络推广外包百度手机seo软件
  • 招聘网站设计方案电商网站运营
  • 网站建设的五类成员权重查询工具
  • android 网站模板下载上海网络推广外包
  • 苏州园区限电淘宝网店的seo主要是什么
  • 四川省建设厅网站证域名seo站长工具
  • asp 免费网站模板短视频推广平台
  • 深圳商城网站制作公司代运营哪家公司最靠谱
  • 深圳有名的室内设计公司搜索引擎优化怎么做的
  • 网站建设岗位能力惠州自动seo
  • 深入浅出wordpress下载培训机构优化
  • 建筑模板生产厂家有哪些南宁seo手段
  • 外贸多语言网站好用的推广平台
  • 河南省城乡建设厅网站深圳网站优化软件
  • wordpress时光轴插件seoul national university
  • go语言可以做网站吗网站注册信息查询
  • 网站建设员工分工今日头条新闻大事
  • 江苏昆山网站建设合肥网站排名推广
  • 绵阳市城乡建设委员会官方网站郑州seo优化顾问
  • wordpress cms 教程北京网站优化实战
  • 做网站涉及到哪些网站建设及网站推广
  • php建站程序上海网站推广系统
  • 社交网站的优点和缺点微信软文范例100字