我对Python还不熟悉。我正在开发MacOS,我有python2.7.15。你知道吗
我正在尝试从用户那里获取输入:
#these two rows do not execute at the same time, it's just an example :)
annee = raw_input("Saisissez une annee : ") #works if input is string, but not if it's int
annee = input("Saisissez une annee : ") #works if input is int, but not if it's string
try:
anne = int(annee)
# isBissextile(annee)
except:
print("Erreur lors de la saisie")
正如我在评论中所说,input和raw\u输入没有按预期工作,我希望能够获得int或string输入,然后显示exception或not
你想这样吗?不过,它也在做同样的事情。你知道吗
相关问题 更多 >
编程相关推荐