728x90
* replace
a.replace("a를":"b로":"n번")
a = 'xoxoxoxoxoxoxo'
a.replace('xo', '#', 1)
print(a)
>>> #xoxoxoxoxoxo
* 정렬 : sort()
a = [2, 1, 3, 4, 5]
a.sort()
print(a)
>>> [1, 2, 3, 4, 5]
내림차순 하는 법
1)
a.sort()
a.reverse()
2)
a.sort(reverse = True)
728x90
'Language > Python' 카테고리의 다른 글
python 오류 메시지 모음 (0) | 2023.02.10 |
---|