第四节:python if语句用法
2016-10-13 08:38
656 查看
name=raw_input('pelase input your name:') age=raw_input('pelase input your age:') job=raw_input(pelase input your jobs:) test= """ name : %s age : %s job : %s """ %(name,age,job) print test print type(age) #测试输入的字符类型。 if int(age)>=30: print "you are too old!" else: print "you are very young!" 重点: age=int(raw_input('pelase input your age:')) int(age)的用法:强制转换字符串为数字大小。str为字符串,int为数字大小。 age = raw_input('pelase input your age:').strip() print len(age) .strip()跳过空格的用法。 print len(age)统计字符串长度的用法。
相关文章推荐
- Python中的if、else、elif语句用法简明讲解
- python if语句用法解析
- Python入门教程之if语句的用法
- Python中的if、else、elif语句用法简明讲解
- Python - while语句和if语句 的 用法 及 代码
- Python if语句知识点用法总结
- 讲解Python中if语句的嵌套用法
- 讲解Python中if语句的嵌套用法
- Python学习笔记(二)if语句的简单用法
- Python入门教程之if语句的用法
- Python - while语句和if语句 的 用法 及 代码
- python if语句语法
- #define fun() do {a***; b***;} while(0)在if语句后的用法探讨
- [笔记]Python虚拟机对if语句的解释
- android Monkeyrunner:Python语法知识学习(for,while,if用法实例)
- Shell if语句用法小结
- Python学习--控制语句:if, while, for, break, continue
- 视频10学习心得----if语句的嵌套结构以及用法
- JavaScript If else 语句用法 【每日一段代码43】
- oracle:IF语句 Loop循环 Cursor的用法(二)