第一阶段
第六章
6.7元组
text1 = ('周杰伦', 11, ['football', 'music']) index = text1.index(11) print(index) print(text1[0]) del text1[2][1] print(text1) text1[2].append("coding") print(text1)
6.8 字符串
my_str = "itheima and itcast" index = my_str.index("and") print(index) #replac并没有修改字符串,而是创建了一个新的字符串 new_my_str = my_str.replace("it", "程序") print(my_str, new_my_str) #split 按分隔符分割字符串 成为列表 my_str = ("hello itheima itcast world") my_list = my_str.split(' ') print(my_list)
p69 10:51
标签:index,python,day7,字符串,text1,str,print,my From: https://www.cnblogs.com/piaoguo326/p/17480876.html