元组,字符串的基础
元組,字符串,
'''a=(1,2,3,4,56,) type(a) print(type(a)) #元祖就是不可變列表 ''''''username=input("username:") if username.strip()=="spencer": #語句能夠讓輸入的內容多按空格:移除空白print("welcome") ''''''names="jack,alex,spencer,tony" name1=names.split(",") #切分 print(name1) name2=(":".join(name1)) #合并 print(name2) print(":".join(name1)) ''''''msg="if want{0}, then we will{1}" msg1=msg.format(111,222) print(msg1) ''''''name="spencersun" print(name[2:4]) print(name.center(50,"~")) '''username=input("name:") if username.isdigit():username=int(username) else:print("invalid")?
轉載于:https://www.cnblogs.com/spencersun/p/9078088.html
總結
- 上一篇: html5透明图片格式,半透明图片制作
- 下一篇: 【tensorflow】——创建tens