object의 인쇄 가능한 표현을 포함하는 문자열을 리턴합니다.
문자열에서 \x, \u, \U를 써서 ASCII 문자가 아닌 문자를 이스케이프 시킵니다.
normalText = 'Python is interesting'
print(ascii(normalText))
otherText = 'Pythön is interesting'
print(ascii(otherText))
print('Pyth\xf6n is interesting')
결과
'Python is interesting' 'Pyth\xf6n is interesting' Pythön is interesting
© 2022 pinfo. All rights reserved.