标签:for line file 字符串 ef return list print
string1 = ‘‘‘‘‘
the stirng
Has many
line In
THE fIle
‘‘‘
list_of_string = string1.split()
print list_of_string #将字符串分离开,放入列表中
print ‘*‘*50
def case_insensitive_sort(liststring):
listtemp = [(x.lower(),x) for x in liststring]
listtemp.sort()
return [x[1] for x in listtemp]
print case_insensitive_sort(list_of_string)
def case_insensitive_sort2(liststring):
return sorted(liststring,key = str.lower)
if __name__==‘__main__‘:
print case_insensitive_sort2([‘c‘,‘a‘,‘1‘,‘.‘])
pyqt字符串分离开,放入列表中,布布扣,bubuko.com
标签:for line file 字符串 ef return list print
原文地址:http://www.cnblogs.com/mhxy13867806343/p/3874002.html