这是我的代码:蟒蛇 - 错误类型
def get_num():
number = int(raw_input(" ")),
print "|"
return number
list_of_letter = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z']
num = -1
print "welcome to the sudoko maker!!!"
print "I will start asking you information."
for lines in range (9):
for ask in range(9):
if num == 25:
num = 0
num = num + 1
print list_of_letter [num],
print
,当我运行它的Python写: IndexError:列表索引超出范围 为什么????
不要浪费问号! – Paolo
@Guandalino:嘿,不要这么快判断。也许Python 3.4将'IndexError'的默认错误描述从''list index out of range''改为''list index out of range why'''。 :) – abarnert
@Roey,我不是一个答案,但仍然可以帮助:对于这类问题考虑使用称为[pdb]的Python模块(http://docs.python.org/2/library/pdb.html )。这是调试器(基本上你会使用'pdb.set_trace()'和一些键,比如l,n,c,s等等)。这是一个非常教学,自助和不太复杂的工具。如果您仍然遇到问题,请在分享您的发现的问题中添加详细信息。也许一些downvote也会消失。 – Paolo