![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
新时光,我好
学习python可以一起交流
展开
-
if_while_for语句的使用
#if语句的使用 age=input("请输入你的年龄:") age=int(age) if age>18: print("已经成年") else: print("未成年") #if语句and的使用 age=int(input("请输入你的年龄:")) if age>0 and age<=18: print("未成年") elif age&am原创 2018-09-09 18:41:14 · 354 阅读 · 0 评论 -
python_字符串常见操作
#字符串在python中为不可变类型,这意味着不能对字符串经行修改才做 mystr="hello" print(mystr) #mystr[1]='e' # 修改字符串的第二个字符,会报错:TypeError: 'str' object does not support item assignment #字符串类型转换 a=100 a=str(a) #字符串连接操作 a="lao" b="wan...原创 2018-09-09 22:21:07 · 264 阅读 · 0 评论