1.整数 int
a.
n1= 123
n2 =456
(n1+n2)
print(n1.__add__(n2))
b.
获取可表示的二进制最短位数
n1 = 4 #00000100
ret = n1.bet_length()
print(ret)
2.字符串
a1= "alex"
ret =a1.capitalize() #首字母大写
print(ret)
ret =a1.center(20,'*') #居中,长度20
print(ret)
a1 = "alex is alph"
ret=a1.count("a",0,10) #从0到第10个子串出现的次数
print(ret)
temp = "hello"
print(temp.endswith('o')) #是否是以o结尾的
content = "hello\t999"
print(content.expandtabs()) #将tab换成空格
print(content.expandtabs(20))
s = "alex hello "
print(s.find("ex")) #返回找到的子串的位置,没找到返回-1
s= "hello {0},age {1}"
print(s)
#{0占位符}
new1= s.format('alex',19) #格式化,0.1都是占位符
print(new1)
#jion
li = ["alex","eric"] #列表类型
s="_".join(li) #用_链接字符串
print(s)