数字:int
#字符串转换整型
a = "123"
print(type(a),a)
b = int(a)
print(type(b),b)
b = b + 1000
print(b)
字符串:str
首字母大写:capitalize()
test = "charon"
v =test.capitalize()
print(v)
所有变小写lower()
test = "chAron"
v1 = test.lower()
print(v1)
设置宽度,并将内容居中
20代表总长度
*代表空白位置填充,一个字符可有可无
test = "charon" v2 = test.center(20,"*") print(v2)
布尔值:bool
列表:list
元祖: tuple
字典:dict