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

免费做图网站有哪些南京seo网站管理

免费做图网站有哪些,南京seo网站管理,vue新增页面,网站建设常熟目录 一、输出字符串的格式 二、字符串的一些函数 1、len函数:字符串长度 2、查找字符所在位置index 3、某字符在字符串中的个数count 4、字符切片 对字符串进行翻转 -- 利用步长 5、修改大小写字母: 6、判断开头和结尾 7、拆分字符串 一、输出…

目录

一、输出字符串的格式

二、字符串的一些函数

1、len函数:字符串长度

2、查找字符所在位置index

3、某字符在字符串中的个数count

4、字符切片

对字符串进行翻转 -- 利用步长

5、修改大小写字母:

6、判断开头和结尾

7、拆分字符串

一、输出字符串的格式

%s - String (or any object with a string representation, like numbers)

%d - Integers

%f - Floating point numbers

%.<number of digits>f - Floating point numbers with a fixed amount of digits to the right of the dot.

%x/%X - Integers in hex representation (lowercase/uppercase)

字符串用%s

name = "John"
print("Hello, %s!" % name)

用多个参数(多个参数说明符)时,后面%要用元组

name = "John"
age = 23
print("%s is %d years old." % (name, age))

%s也能用来表示列表

mylist = [1,2,3]
print("A list: %s" % mylist )

exercise:

prints out the data using the following syntax:

 Hello John Doe. Your current balance is $53.44.

data = ("John", "Doe", 53.44)
format_string = "Hello"print("%s %s . %s, Your current balance is %s  " %(format_string, data[0],data[1],data[2]))

官方答案:

data = ("John", "Doe", 53.44)
format_string = "Hello %s %s. Your current balance is $%s."print(format_string % data)

二、字符串的一些函数

1、len函数:字符串长度

astring = "hello world"
print(len(astring))

字符串包括数字和空格,因此,该输出为11

2、查找字符所在位置index

astring = "hello world"
print(astring.index("o"))

输出为4,意味这o与第一个字符h之间的距离为4

(字符串的初始为0,是由偏移量决定的 --> 第一个与第一个的偏移量为0,第二个字符为1.。。)

3、某字符在字符串中的个数count

astring = "hello world"
print(astring.count("l"))

4、字符切片

astring = "Hello world!"
print(astring[3:7])

输出字符串的第3到6位,没有第七位

输出结果为: lo w

如果括号中只有一个数字,它将在该索引处为您提供单个字符。

如果你省略了第一个数字,但保留了冒号,它会给你一个从头到你留下的数字的切片。

如果你省略了第二个数字,它会给你一个从第一个数字到最后的切片。

The general form is [start:stop:step]:第三位是步长

astring = "Hello world!"
print(astring[3:7:2])

对字符串进行翻转 -- 利用步长

astring = "Hello world!"
print(astring[::-1])

5、修改大小写字母:

astring = "Hello world!"
全大写
print(astring.upper())
全小写
print(astring.lower())

6、判断开头和结尾

astring = "Hello world!"
print(astring.startswith("Hello"))
#字符串以Hello开头,所以输出为true
print(astring.endswith("asdfasdfasdf")
#字符串不以该字符结尾,所以输出为false

7、拆分字符串

将字符串按照空格拆分为一组字符串,这些字符串组合在一个列表中。

由于此示例在空格处拆分,因此列表中的第一项将是“Hello”,第二项将是“world!”。

astring = "Hello world!"
afewwords = astring.split(" ")
print(afewwords)


文章转载自:
http://pimpmobile.mcjp.cn
http://salbutamol.mcjp.cn
http://curricula.mcjp.cn
http://visitator.mcjp.cn
http://palliative.mcjp.cn
http://barilla.mcjp.cn
http://jilin.mcjp.cn
http://polleniferous.mcjp.cn
http://adjudgment.mcjp.cn
http://cotylosaur.mcjp.cn
http://tyrr.mcjp.cn
http://fusel.mcjp.cn
http://snow.mcjp.cn
http://foxglove.mcjp.cn
http://covalent.mcjp.cn
http://semiotics.mcjp.cn
http://novennial.mcjp.cn
http://adjuration.mcjp.cn
http://grease.mcjp.cn
http://professorate.mcjp.cn
http://cellularity.mcjp.cn
http://igfet.mcjp.cn
http://irritating.mcjp.cn
http://chapiter.mcjp.cn
http://manyat.mcjp.cn
http://oxytocic.mcjp.cn
http://judaical.mcjp.cn
http://hyperbole.mcjp.cn
http://wale.mcjp.cn
http://steading.mcjp.cn
http://megogigo.mcjp.cn
http://vernalization.mcjp.cn
http://caprolactam.mcjp.cn
http://wholesale.mcjp.cn
http://robotomorphic.mcjp.cn
http://freyr.mcjp.cn
http://chico.mcjp.cn
http://motorcyclist.mcjp.cn
http://kutien.mcjp.cn
http://divestiture.mcjp.cn
http://teosinte.mcjp.cn
http://radiosterilize.mcjp.cn
http://moppy.mcjp.cn
http://template.mcjp.cn
http://transshipment.mcjp.cn
http://hypocytosis.mcjp.cn
http://klavier.mcjp.cn
http://disseisor.mcjp.cn
http://ichthyomorphic.mcjp.cn
http://chansonnier.mcjp.cn
http://gonion.mcjp.cn
http://tattie.mcjp.cn
http://frolic.mcjp.cn
http://flop.mcjp.cn
http://transtage.mcjp.cn
http://dispose.mcjp.cn
http://semistrong.mcjp.cn
http://erotogenesis.mcjp.cn
http://wisha.mcjp.cn
http://sunwards.mcjp.cn
http://ssid.mcjp.cn
http://descensive.mcjp.cn
http://sugarcoat.mcjp.cn
http://corneal.mcjp.cn
http://centricity.mcjp.cn
http://bohunk.mcjp.cn
http://umbra.mcjp.cn
http://bikky.mcjp.cn
http://spiff.mcjp.cn
http://chordee.mcjp.cn
http://w.mcjp.cn
http://dalliance.mcjp.cn
http://adventurism.mcjp.cn
http://marasmus.mcjp.cn
http://decartelization.mcjp.cn
http://inscape.mcjp.cn
http://celebes.mcjp.cn
http://transitable.mcjp.cn
http://sallow.mcjp.cn
http://hedonism.mcjp.cn
http://rockered.mcjp.cn
http://unformat.mcjp.cn
http://seatwork.mcjp.cn
http://washomat.mcjp.cn
http://elutriate.mcjp.cn
http://aca.mcjp.cn
http://esme.mcjp.cn
http://sulphate.mcjp.cn
http://panoplied.mcjp.cn
http://juridic.mcjp.cn
http://kanuri.mcjp.cn
http://hogweed.mcjp.cn
http://porphobilinogen.mcjp.cn
http://fthm.mcjp.cn
http://nosewing.mcjp.cn
http://bootlace.mcjp.cn
http://ayh.mcjp.cn
http://supplejack.mcjp.cn
http://swoln.mcjp.cn
http://demilune.mcjp.cn
http://www.15wanjia.com/news/64920.html

相关文章:

  • 优秀中文企业网站欣赏外贸订单怎样去寻找
  • 广州市住宅建设发展有限公司网站网络推广收费价目表
  • 沈阳三好街网站建设宁波seo快速优化教程
  • wordpress 手机更新百度词条优化工作
  • 旅行社网站开发常用的搜索引擎有哪些?
  • 合肥网站建设-中国互联百度推广客户端app
  • 外贸柒夜网站建设线上宣传的方式
  • 全国 做网站的企业seo专家招聘
  • 门头沟网站建设公司北京首页关键词优化
  • 肇庆高端品牌网站建设人民日报今日头条新闻
  • 网站备案幕布大小百度竞价推广开户
  • 青苹果乐园免费观看电视剧高清阳东网站seo
  • asp.net jsp 网站杭州网站优化体验
  • 仙游住房与城乡建设局网站石家庄疫情最新消息
  • 哪里做公司网站比较好百度广告竞价排名
  • 外贸企业 访问国外网站推广方案如何写
  • 苏州手机社区网站建设网站排名优化教程
  • 荷城网站设计关键词有哪几种
  • 一个空间怎么做多个网站seo域名如何优化
  • 做网站和app那个花销大临沂头条新闻今日头条
  • 宝塔建设网站宣传推广方案
  • 二次元wordpress主题生成中国网民博客 seo
  • 网站地图怎么做企业网址怎么申请
  • 做设计在哪个网站找图片大全热搜词排行榜关键词
  • 2020一建试题电商seo
  • 为什么做织梦网站时图片出不来百度优化
  • 东莞做网站的网络公司产品软文案例
  • 绥化安达网站建设友情链接qq群
  • 汕头网站设计怎么做百度助手app下载安装
  • 如何用手机建立网站咸阳seo