a = "10" a = int(a) print(a)
a = 10 a = bool(a) print(a)
只有0才是false,其他值是True
list:列表 tuple:元组 set 集合 dict:字典
name_list = [‘a’,‘b’,‘c’]
name_tuple = tuple(name_list)
name_list = ['a','b','c']
name_dict = dict.fromkeys(name_list, 默认值)
name_dict = {}
name_list = list(name_dict)
会把字符串中每一个字符当做列表元素
name_str = "laosunaiyouyong"
name_list = list(name_str)
print(name_list)
name_str = 'sun jia nan'
name_list = name_str.strip().split(" ")
print(name_list)
name_list = ['sun','jia','nan']
name_str = " ".join(name_list)
print(name_str)