物体的2

help +类:查看类的所有功能,并对每个功能进行详细介绍

 

 

基本类型的常用功能:

1 数字

bit_length:数字最小占几位

n1+n2 ===n1.__add__(n2)

2 字符串

capitalize:首字母变大写

center:居中 a.center(20,'*')

count:子序列在序列中出现的次数 al.count("a") 起止位置al.count("a",0,4)

endswith:判断是否以其结尾 temp.endswith("e") 起止位置temp.endswith("e",0,2)

extendtabs:tab换算成空格,默认是8个 temp.extendtabs();temp.extends(20)

\t代表tab建

find:找到子序列的位置,找不到返回-1 s.find("l")

{0}

{1}:占位符 s.format("alex",'9')

index:与find一样,找不到报错

self 代表不用传参数

a.isalnum

a.isalphat

a.isspacet

a.isupper

join:参数可迭代;“-”.join(li):li是序列

a.istitle

a.isdigit

a.ljust:佐伊

a.lstrip:移除支付穿左边的空格

a.rstrip:

a.strip

a.partition("SB") :把字符串分割,由元祖承载

a.replace("al","BB",1)

a.rfind

a.split(e):yong e ba zifu chuan fen ge

a.swapcase()

a.title()

posted @ 2017-04-05 17:59  hjp123518  阅读(91)  评论(0)    收藏  举报