print "What is your name?",
name = len(raw_input())
print name
print "How old are you?",
age = int(input())
print "What month were you born in? ",
month = int(input())
if (month>12) or (0>month):
print "That does not exist"
else:
all = (name+age+month)
print "Your name length plus your age plus",
print "the month you were born is equal to:",
print all
如果您运行的代码有效,但在提示输入月份编号时,如果输入8,它将起作用,但如果输入08,则不会。有人可以告诉我为什么。我使用Python 2.7Python:为什么不接受01或02或03的月份输入?
请不要在Python 2中使用'input()',因为它在任意用户输入上调用'eval()',这是一个_huge_安全缺陷。请参阅SO成员Ned Batchelder的[Eval really dangerous](http://edbatchelder.com/blog/201206/eval_really_is_dangerous.html)。 – 2015-02-24 03:32:20