[Python] String
Python string → immutable;
indexing으로 문자 못바꿈
문자 -> ASCII 값 : ord
ASCII 값 -> 문자 : chr
https://lsjsj92.tistory.com/201
Concat
Formatting
%-formatting (obsolete? https://stackoverflow.com/questions/1455602/printing-tuple-with-string-formatting-in-python) 말고, str.format() 사용하자.
Update - 더더 나은 f-string을 쓰자!
Python: 문자열 포맷팅 (String Formatting)
formatting 이란 문자열을 더 잘 표현하기 위한 방법이다. 1. %-formatting % 연산자 사용하는 경우이다. 문자열에 숫자, 문자열을 대입할 수 있고, %d %f %s 등이 사용된다. 언어 초반에 사용되었으며, c언�
velog.io
https://docs.python.org/3/library/string.html#formatstrings
string — Common string operations — Python 3.8.5 documentation
string — Common string operations Source code: Lib/string.py String constants The constants defined in this module are: string.ascii_letters The concatenation of the ascii_lowercase and ascii_uppercase constants described below. This value is not locale-
docs.python.org
'<언어> > [Python]' 카테고리의 다른 글
데코레이터 + @lru_cache 데코레이터를 활용한 DP 캐싱 (0) | 2021.06.03 |
---|---|
[Python 심화] 이터레이터와 제너레이터 (0) | 2021.05.11 |
기타 snippet (0) | 2021.04.20 |
[Python] Input / Output (0) | 2020.12.26 |
[Python] Asterisk (*) 용도 (0) | 2020.09.01 |