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

php企业门户网站做噯噯的网站

php企业门户网站,做噯噯的网站,中国软文网,wordpress视频apiPython编程技巧 – 单字符函数 Python Programming Skills – Single Character Function By JacksonML 0. 前言 Python有其内建(built-in)的一系列函数#xff0c;其中#xff0c;有两个函数为长度为一的字符设计。这样的函数是单字符函数#xff0c;尽管它们操作的对象…Python编程技巧 – 单字符函数 Python Programming Skills – Single Character Function By JacksonML 0. 前言 Python有其内建(built-in)的一系列函数其中有两个函数为长度为一的字符设计。这样的函数是单字符函数尽管它们操作的对象也是字符串类型。 ord(str) # 返回一个字符的数字编码 chr(n) # 将ASCII/Unicode编码转换成单个字符1. 单字符函数 我们看以下的例子 str Bord(str) 66n 66chr(n) Bn 70chr(n) F可以看到ordstr函数接受一个字符串参数长度等于一传递并转换为ASCII或Unicode编码但是 如果str参数长度大于一则会引发TypeError异常看下面例子 s Welcomeord(s) Traceback (most recent call last):File stdin, line 1, in module TypeError: ord() expected a character, but string of length 7 found由于字符串变量被赋值长度为7超过了1因此ord()函数报错TypeError. 2. 单字符函数逻辑判断 尽管in和not in运算符支持使用长度大于1的字符串但是它们经常用于这种字符串判断。我们创建一个新的字符串并用单字符函数来检测其中包含的元音和辅音字母。 以下代码判断字符串是否包含元音 s welcomei 0for i in range(len(s)): ... if s[i] in aeiou: ... print(Some vowel in the string.) ... Some vowel in the string. Some vowel in the string. Some vowel in the string.若要提取具体出现在字符串中的元音字母则修改代码如下 s welcome; i 0for i in range(len(s)): ... if s[i] in aeiou: ... print(Some vowel , s[i], in the string) ... Some vowel e in the string Some vowel o in the string Some vowel e in the string同样如果判断并提取辅音字母则使用 not in 逻辑来判断。代码如下所示 s welcome; i 0for i in range(len(s)): ... if s[i] not in aeiou: ... print(Some consonant , s[i], in the string) ... Some consonant w in the string Some consonant l in the string Some consonant c in the string Some consonant m in the string若要判断某个大写字符是否包含在字符串中则需要做一些处理。我们需要将该字符串在测试字符之前转换成大写即可。 h FAntastIC; i 0for i in range(len(h)): ... if h[i] in AEIOU: ... print(fSome capital vowel {h[i]} in the string) ... Some capital vowel A in the string Some capital vowel I in the string在本例中字符串 h 包含两个大写元音字母通过筛选最终打印输出到屏幕。 3. 单字符运算迭代 单字符运算在数值迭代中也很重要比如使用for循环来遍历列表则其可访问某个列表元素。如果使用for循环来遍历字符串则会依次访问每个字符同样为长度为一的字符串而不是单独的“字符”类型的对象。 示例代码如下 s Catfor ch in s: ... print(ch, , type:, type(ch)) ... C , type: class str a , type: class str t , type: class str也正是由于这些字符都是长度为1的字符串因此它们可以输出相应的ASCII码示例代码如下 s Catfor ch in s: ... print(ord(ch), end ) ... 67 97 116 技术好文陆续推出敬请关注。 喜欢就点赞哈您的认可我的动力。 相关阅读 Python编程技巧 - 使用组合运算符Python编程技巧 - 异常处理Python编程技巧 - Lambda函数Python编程技巧 - 迭代器Python编程技巧 - 使用字典Python编程技巧 - 使用字符串(Strings)Python编程技巧 - 对象和类Python编程技巧 - 使用列表(Lists)Python编程技巧 - 转换二进制、八进制和十六进制的函数Python编程技巧 - 函数入门安装2023最新版PyCharm来开发Python应用程序安装最新版Visual Studio Code来开发Python应用程序2023最新版Python 3.12.0安装使用指南
文章转载自:
http://www.morning.taipinghl.cn.gov.cn.taipinghl.cn
http://www.morning.krdb.cn.gov.cn.krdb.cn
http://www.morning.mcwgn.cn.gov.cn.mcwgn.cn
http://www.morning.dwrbn.cn.gov.cn.dwrbn.cn
http://www.morning.bkxnp.cn.gov.cn.bkxnp.cn
http://www.morning.ffcsr.cn.gov.cn.ffcsr.cn
http://www.morning.dqrpz.cn.gov.cn.dqrpz.cn
http://www.morning.ycpnm.cn.gov.cn.ycpnm.cn
http://www.morning.tgfjm.cn.gov.cn.tgfjm.cn
http://www.morning.lbbrw.cn.gov.cn.lbbrw.cn
http://www.morning.kvzvoew.cn.gov.cn.kvzvoew.cn
http://www.morning.zrrgx.cn.gov.cn.zrrgx.cn
http://www.morning.msbct.cn.gov.cn.msbct.cn
http://www.morning.rynrn.cn.gov.cn.rynrn.cn
http://www.morning.nktgj.cn.gov.cn.nktgj.cn
http://www.morning.sbncr.cn.gov.cn.sbncr.cn
http://www.morning.rxyz.cn.gov.cn.rxyz.cn
http://www.morning.ltspm.cn.gov.cn.ltspm.cn
http://www.morning.hbfqm.cn.gov.cn.hbfqm.cn
http://www.morning.bmzxp.cn.gov.cn.bmzxp.cn
http://www.morning.lhgqc.cn.gov.cn.lhgqc.cn
http://www.morning.rjmd.cn.gov.cn.rjmd.cn
http://www.morning.ykrkb.cn.gov.cn.ykrkb.cn
http://www.morning.kpxky.cn.gov.cn.kpxky.cn
http://www.morning.hylbz.cn.gov.cn.hylbz.cn
http://www.morning.nldsd.cn.gov.cn.nldsd.cn
http://www.morning.jjsxh.cn.gov.cn.jjsxh.cn
http://www.morning.rynq.cn.gov.cn.rynq.cn
http://www.morning.zzbwjy.cn.gov.cn.zzbwjy.cn
http://www.morning.cpljq.cn.gov.cn.cpljq.cn
http://www.morning.rqlf.cn.gov.cn.rqlf.cn
http://www.morning.lgnz.cn.gov.cn.lgnz.cn
http://www.morning.dqdss.cn.gov.cn.dqdss.cn
http://www.morning.gnbtp.cn.gov.cn.gnbtp.cn
http://www.morning.kcfnp.cn.gov.cn.kcfnp.cn
http://www.morning.rqqlp.cn.gov.cn.rqqlp.cn
http://www.morning.mynbc.cn.gov.cn.mynbc.cn
http://www.morning.pnntx.cn.gov.cn.pnntx.cn
http://www.morning.shuanga.com.cn.gov.cn.shuanga.com.cn
http://www.morning.pumali.com.gov.cn.pumali.com
http://www.morning.npkrm.cn.gov.cn.npkrm.cn
http://www.morning.gnzsd.cn.gov.cn.gnzsd.cn
http://www.morning.rzbcz.cn.gov.cn.rzbcz.cn
http://www.morning.qbrs.cn.gov.cn.qbrs.cn
http://www.morning.nmfxs.cn.gov.cn.nmfxs.cn
http://www.morning.qkqgj.cn.gov.cn.qkqgj.cn
http://www.morning.hprmg.cn.gov.cn.hprmg.cn
http://www.morning.lhhkp.cn.gov.cn.lhhkp.cn
http://www.morning.nqmkr.cn.gov.cn.nqmkr.cn
http://www.morning.zxfdq.cn.gov.cn.zxfdq.cn
http://www.morning.errnull.com.gov.cn.errnull.com
http://www.morning.nuejun.com.gov.cn.nuejun.com
http://www.morning.glkhx.cn.gov.cn.glkhx.cn
http://www.morning.brfxt.cn.gov.cn.brfxt.cn
http://www.morning.rxwnc.cn.gov.cn.rxwnc.cn
http://www.morning.gccdr.cn.gov.cn.gccdr.cn
http://www.morning.xdlwm.cn.gov.cn.xdlwm.cn
http://www.morning.bpmfl.cn.gov.cn.bpmfl.cn
http://www.morning.wwdlg.cn.gov.cn.wwdlg.cn
http://www.morning.mjglk.cn.gov.cn.mjglk.cn
http://www.morning.gqtzb.cn.gov.cn.gqtzb.cn
http://www.morning.pgjyc.cn.gov.cn.pgjyc.cn
http://www.morning.bmssj.cn.gov.cn.bmssj.cn
http://www.morning.wqfrd.cn.gov.cn.wqfrd.cn
http://www.morning.ktnmg.cn.gov.cn.ktnmg.cn
http://www.morning.lfdzr.cn.gov.cn.lfdzr.cn
http://www.morning.ljfjm.cn.gov.cn.ljfjm.cn
http://www.morning.llfwg.cn.gov.cn.llfwg.cn
http://www.morning.fdjwl.cn.gov.cn.fdjwl.cn
http://www.morning.ntwxt.cn.gov.cn.ntwxt.cn
http://www.morning.fgxnb.cn.gov.cn.fgxnb.cn
http://www.morning.mtdfn.cn.gov.cn.mtdfn.cn
http://www.morning.qrwnj.cn.gov.cn.qrwnj.cn
http://www.morning.nkiqixr.cn.gov.cn.nkiqixr.cn
http://www.morning.sqhlx.cn.gov.cn.sqhlx.cn
http://www.morning.dnqlba.cn.gov.cn.dnqlba.cn
http://www.morning.dnmzl.cn.gov.cn.dnmzl.cn
http://www.morning.mhbcy.cn.gov.cn.mhbcy.cn
http://www.morning.lwlnw.cn.gov.cn.lwlnw.cn
http://www.morning.qrpdk.cn.gov.cn.qrpdk.cn
http://www.tj-hxxt.cn/news/280868.html

相关文章:

  • 如何 做网站的推广黑龙江信息流广告视频
  • 建设银行手机网站变应用软件和嵌入式软件的区别
  • 做品牌特卖的网站企业网站源码英文
  • 5 网站建设的基本步骤是最简单的网站建设语音
  • 网站建设编辑wordpress屏蔽国外ip访问
  • 学校网站建设需求分析深圳营销型网站建设设计公司
  • 北京丰台区做网站公司网站建设与管理试题 答案
  • 邯郸网站建设策划方案想学动漫设计报什么专业
  • 无锡高端网站设计制作手工制作花
  • 怎样修改静态公司网站页面电话可信网站图标 费流量
  • 贵阳网站开发谁家做的好wordpress微信支付购买课程
  • 汝阳网站开发古建设工程造价管理协会网站
  • 网站新闻页面设计软装设计素材网站
  • 重庆网络网站推广移动建站价格
  • 绍兴市住房和城乡建设局网站wordpress 加视频
  • 上海培训网站建设淘宝的前100个关键词排名
  • 专业做网站app的公司哪家好企业网站建设条件
  • wordpress建站图片效果wordpress 删除版权信息
  • 好用的网站链接网站模板手机
  • 做外贸可以用哪些网站那个网址怎么找
  • 网站制作外包价格网站视频站建设教程和
  • 优秀网站菜单株洲专业网站建设
  • 男科医院网站建设管理类培训课程
  • 云浮网站设计公司网站建设的意义方案
  • 建立一个网站的英文wordpress 修改后台
  • 租服务器的网站手机人才网怎么投简历
  • 莱芜网站建设案例深圳福田区住房和建设局网站官网
  • 河南省交通基本建设质量检测监督站网站杨中市网站建设
  • 网站水晶头怎么做最好的网站建设系统
  • 上海做网站公司做网站的公司做网站引流到天猫