我有一个 def 函数,如下所示:
def update(marks, num, mark, column):
lines = [l for l in marks]
for row in range(len(all_marks)):
if all_marks[row][0] == num:
lines[row][column] = mark
elif lines[row][column] != '':
print num + ' already has a value in column - update ignored.'
另一个 def 函数中的 raw_input 函数如下所示:
result1 = raw_input('Enter results file: ')
num = raw_input('Student number (empty to finish): ')
if len(snumber) == 0:
print
print
print 'finished'
print
print
return interact()
else:
pass
column2 = raw_input('Enter column: ')
newresult1 = raw_input('New result: ')
try:
print update(result1, snumber, newresult1, column2)
except IOError:
print 'Try again'
从底部算起的第三行应该打印 def update(marks, num, mark, column) 但它一直没有返回。
抱歉,代码有点乱。谁能让我知道我做错了什么?
提前致谢。