나는 파일의 상단에 #coding=utf-8
같은 마법의 코멘트를 사용하려고하면 유니 코드 문자열 인코딩 선언, 여기 무슨 일이야 : 잘못된구문 에러 :
Traceback (most recent call last):
File <string>, line 0
SyntaxError: encoding declaration in Unicode string
정말하지 않은 것도. 코드는 다음과 같습니다.
#coding=utf-8
string = raw_input()
chars = {}
for i in string:
if i in chars:
chars[i] += 1
else:
chars[i] = 0
print chars
repl.it을 사용합니다.
'코딩'이 아니라 '코딩'입니다. – DeepSpace
@DeepSpace [여기] (https://www.python.org/dev/peps/pep-0263)를 참조하십시오. 물론'coding '할 수 있습니다! –
@DeepSpace : 아니요. 그것은'디코딩','플루 브 코딩'또는'코딩'일 수 있습니다. 사용 된 정규식은 상관하지 않습니다. [코딩 = utf8과 '- \ * 코딩 : utf-8 - \ * -'의 차이점은 무엇입니까?] (https://stackoverflow.com/a/20302074) –