三木社区

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 380|回复: 0
打印 上一主题 下一主题

Ex114-字符串判断实验

[复制链接]

1657

主题

1684

帖子

5684

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
5684
跳转到指定楼层
楼主
发表于 2017-6-5 10:05:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
实验目的:
1.字符串处理函数用法
示例代码:
  1. # -*- coding: cp936 -*-
  2. # main.py -- put your code here!

  3. print("Test One")
  4. str = "runoob.com"
  5. print(str.isalpha())    # 判断所有字符都是字母
  6. print(str.isdigit())    # 判断所有字符都是数字
  7. print(str.islower())    # 判断所有字符都是小写
  8. print(str.isupper())    # 判断所有字符都是大写
  9. print(str.isspace())    # 判断所有字符都是空白字符、\t、\n、\r

  10. print("------------------------")

  11. print("Test Two")
  12. str = "runoob"
  13. print(str.isalpha())    # 判断所有字符都是字母
  14. print(str.isdigit())    # 判断所有字符都是数字
  15. print(str.islower())    # 判断所有字符都是小写
  16. print(str.isupper())    # 判断所有字符都是大写
  17. print(str.isspace())    # 判断所有字符都是空白字符、\t、\n、\r
复制代码


回复

使用道具 举报

Archiver|手机版|小黑屋|三木电子社区 ( 辽ICP备11000133号-4 )

辽公网安备 21021702000620号

GMT+8, 2025-11-18 19:47 , Processed in 0.027930 second(s), 26 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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