python学习01 类,方法

# input()   print( *args, sep=' ', end='\n')
# if elif else
# while for...in... continue break
# int(x=0,base=10) Base 0 means to interpret the base from the string as an integer literal.
# .bit_length() bin(int) -> 0b
# str(object='') (另一种用法待补全)
# S.capitalize() .swapcase() .lower() .upper() .title() .islower() .isupper() .istitle()
# S.center(width,' ') .ljust() .rjust()
# S.count(sub, start=None, end=None) .find() .index() #find找不到返回-1,index找不到报错
# S.endswith('') .startswith()
# .format(*args, **kwargs) .format_map(mapping)
# .isalnum() .isalpha() .isdecimal() .isdigit() .isnumeric() .isprintable() .isspace() isidentifier()
# .join() #对象为可迭代对象,且迭代元素必须为字符
# .strip() .lstrip() .rstrip() #元素及删除
# str.maketrans() .translate() #元素及替换
# .replace(old,new,count=None)
# .split() .splitlines() .partition() .rpartition()
# []索引 [:] 切片 len() range()
# list() 根据可迭代对象创建新列表
# .append() .extend() .insert()
# .clear() .pop() .remove() .copy() del
# .index() .count()
# .reverse() .sort()
# tuple
# dict

# .fromkeys( , )
# .get() .setdefault() .pop() .popitem()
# .update()
# .keys() .values() .items()
# set
# .add()  .clear()  .cop()  .pop()  .discard()  .remove()->报错
# .intersection()  &
# .union()  |
# .difference()  -
# .symmetric_difference()   ^   交叉补集
# .update()  .difference_update()
# .isdisjoint()
# .frozenset()  创建不可变集合
 

 
 


posted @ 2018-10-15 01:17  brzp97  阅读(167)  评论(0)    收藏  举报