Python从键盘输入字符串

ha = input('name:')
print(ha)
--------------------------------------------------------
name:gg

Traceback (most recent call last):
File "C:/Users/Administrator/Desktop/Python/name.py", line 1, in <module>
ha = input('name:')
File "<string>", line 1, in <module>
NameError: name 'gg' is not defined

哪里错了啊

试试这个代码python3.x
s = input('请输入字符串:')
ms = set(s)
for item in ms:
print('字符:',item,'数量:',s.count(item))
温馨提示:答案为网友推荐,仅供参考
相似回答