字符串
---恢复内容开始---
- 字符串r=(1,2,3,4,5) #只读列表,元祖,不可以更改,只能查
- username=input("user")
if username.strip()=="alex": #代表去掉空格
print("welcom") - #字符串拆开
names="alex,jack,rain"
names2=names.split(",")
print(names)
print(names2)
# 字符串合并
names="alex,jack,rain"
names2=names.split(",")
print("|".join(names2)) - #判断是否有空格
name="Alex Li"
print("" in name) #如果有空格会显示 ture - #Format
msg="Hello, {name}, Your age is {age}"
msg2=msg.format(name='Daniel', age=29)
print(msg2) - #判断数字
age= input("your age:")
if age.isdigit():
age=int(age)
else:
print("88")