|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
print('-----------------this is a new day for me----------------')
temp = input("今天对我来说是一个特殊的日子:")
guess = int(temp)
if guess == 是:
print("很不错哦,今天努力了")
print("以后也请你这样努力")
else:
print("自己也要努力起来哦")
print("好好对待每一天吧")
参照P3中的教学,然后运行起来出现问题
-----------------this is a new day for me----------------
今天对我来说是一个特殊的日子:是
Traceback (most recent call last):
File "C:/Users/Montos_/AppData/Local/Programs/Python/Python37-32/first one.py", line 3, in <module>
guess = int(temp)
ValueError: invalid literal for int() with base 10: '是'
guess = str(temp) 此句代码可以省略 而且temp本身就是str 也不需要再次转换
if guess == str("是"): 这里也不需要str
|
|