鱼C论坛

 找回密码
 立即注册
查看: 2046|回复: 0

[技术交流] 字符串函数的使用(3)

[复制链接]
发表于 2017-8-19 16:31:08 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
区分字符串中的字符
1.islower()

含有字符且都是小写字符,返回ture,否则返回false
例如
  1. >>> str1='123456789'
  2. >>> str1.islower()
  3. False
  4. >>> str1='abc546'
  5. >>> str1.islower()
  6. True
复制代码


2.sinumeric()


只含有数字
例如
  1. >>> str1='123456789'
  2. >>> str1.islower()
  3. False
  4. >>> str1='abc546'
  5. >>> str1.islower()
  6. True
复制代码


3.isspace
  1. [/code]
  2. 只包含空格
  3. [code]>>> str1='   '
  4. >>> str1.isspace()
  5. True
复制代码


4.istitle()

所有单词开头大写,其余小写,返回ture
例如
  1. >>> str1='Hello Word'
  2. >>> str1.istitle()
  3. True
复制代码


issupper()
有字符且均为大写,返回ture
例如
  1. >>> str1='AED'
  2. >>> str1.isupper()
  3. True
复制代码


评分

参与人数 1鱼币 +3 收起 理由
小甲鱼 + 3

查看全部评分

本帖被以下淘专辑推荐:

小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-7-4 12:26

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表