1. f prefix : format
_name = jack
_msg = f'Hi {_name}'
print(_msg) => Hi Jack
2. b prefix : bytes
_str = 'this is string'
_bytestr = b'this is byte string'
print(_str) => this is string
print(_bytestr) => b'this is byte string'
3. u prefix : unicode
python 3 defaut encoding is unicode. don't need to use 'u'
4. r prefix : raw
ignore escape character
print('It is raw prefix.\nIs it right?')
=> It is raw prefix.
Is it right?
print(r'It is raw prefix.\nWrong!')
=> It is raw prefix.\nWrong
5. 문자열 포맷(format)
'뇌새김질' 카테고리의 다른 글
[Python] bytes to String변환 (0) | 2021.07.19 |
---|---|
[Python] Method 종류 (instance, class, static) (0) | 2021.07.16 |
[Python] VS Code로 빌드하기 (0) | 2021.06.30 |
[Flutter] 구글 광고(AdMob) 추가 오류 (0) | 2021.06.25 |
[Flutter] 프로젝트 이름 바꾸기 (0) | 2021.06.23 |