!

CODEDRAGON Development/Python

반응형



 

 

!

·         ! 기호를 사용해서 문자열 변환을 있습니다.

·         !s, !r, !a 각각 str(), repr(), ascii()  실행한 결과와 동일한 결과가 출력됩니다.

 

!

method

description

!s

str()

실제값과 다르게 표현될 있습니다.

!r

repr()

형식적으로 동일한 결과를 표현합니다.

!a

ascii()

아스키코드이외 값은 백슬레시 포함한 유니코드값 반환합니다.

 

 

 

 

print("{id!s} is {name!s}".format(**dic))

print("{id!r} is {name!r}".format(**dic))

print("{id!a} is {name!a}".format(**dic))

 


반응형

'Development > Python' 카테고리의 다른 글

세미콜론(;)  (0) 2020.01.15
대입연산자  (0) 2020.01.15
cor()  (0) 2020.01.15
TensorFlow - install  (0) 2020.01.15
할당된 메모리 공간 확인하기  (0) 2020.01.14