감동, 마음이 움직이는 것
[python] replace characters in the string 본문
Tips (Utility, Computer Language, and etc.)
[python] replace characters in the string
Struggler J. 2017. 12. 21. 00:29http://l4wisdom.com/python/python_string.php
replace()
str.replace(old, new, (optional) max)
The replace() returns the string: after replacing the parameter old to new .
The parameter max defined how many occurrences have been replaced. If max is not specified then all occurrences will be replaced.
[Example]
newname = fname.replace("err", "out")
'Tips (Utility, Computer Language, and etc.)' 카테고리의 다른 글
[학회+발표] (0) | 2017.12.23 |
---|---|
[python] dictionary key바꾸기 dic[newkey] = dic.pop(oldkey) (2) | 2017.12.22 |
[python] string안에 여러 특정 문자가 포함되어 있는지 알고 싶을 때 (2) | 2017.12.20 |
[python] array type변경 (0) | 2017.12.14 |
[awk] if문 사용하기 '{if (condition) } action" (0) | 2017.12.14 |