-
List & List member functionPython 2014. 5. 9. 06:39
names = ['hong', 'song', 'ra']
del names[2]
names.append('kang')
names2 = ['brown', 'chris', 'maria']
names.insert(2, 'koa')
names.pop()
if names.count('hong') > 0 :
print ('index of hong is ' + str(names.index('hong')))
names.remove('hong')
names[1] = 'kong'
print (names)
names.sort(key=None, reverse=False)
print (names)
names.reverse()
print (names)
'Python' 카테고리의 다른 글
String Formatting (0) 2014.05.11 String short version & Template (0) 2014.05.10 Tuple (0) 2014.05.09 Slicing (0) 2014.05.07 연속된 문자열 처리 (0) 2014.05.07