Welcome to the most powerful python intelligent question and answer system in history. The following code is valuable, please collect and study it as soon as possible.
I can’t edit it any more, so I’ll go straight to the code:
def is_chinese(str_): # 判断字符串是不是汉字
for ch in(str_):
return True if '\u4e00' <= ch <= '\u9fff' else False # 利用 unicode 判断
while True:
question = input('提示:请使用汉字提问!\n') # 输入问题
if is_chinese(question): # 判断输入是不是汉字
print(question.replace('吗', '').replace('?', '!').replace('你', '')) # 回答问题
else:
print('您输入的不是汉字!')
The effect is as follows:
Finally, congratulations on being cheated, haha! ! !