$ python3
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
5.4.5. 문자열 포맷팅
>>> age = 20
>>> name = 'Swaroop'
>>> print ("{0} was {1} years old".format(name, age))
Swaroop was 20 years old
>>> print ("{1} was {0} years old".format(name, age))
20 was Swaroop years old
>>> print ("{1:.3f} was {0} years old".format(name, age))
20.000 was Swaroop years old
5.4.7 순 문자열
>>> print(r"\a")
\a
>>> print("\a")
'Programming > python(파이썬)' 카테고리의 다른 글
오랫만에 한가로움? (0) | 2020.01.11 |
---|---|
python split (0) | 2020.01.10 |
python 관련 문서들 (0) | 2020.01.09 |
python exception (0) | 2020.01.02 |
python 컴파일하기 및 디컴파일? (0) | 2019.12.14 |