Python使用input().split()报异常,,求救

def calcuClay(): n = int(input()) while n > 0: l1 = [] for i in range(0,n): l1.append(list(input().split())) l1[i][0] = int(l1[i][0]) * int(l1[i][2]) * int(l1[i][1]) l1.sort(key = lambda x:x[0], reverse = False) print(l1[n-1][3] + ' took clay from ' + l1[0][3]) n = int(input())if __name__ == '__main__': calcuClay()
这是我的代码~~~~我自己在电脑上python 3.4上运行挺好的,,在计蒜客的oj平台上,一直报使用input().split()报异常,,求帮助~~~~~

class Calculator(Exception):

try:

x = input('Enter the first number:')

y = input('Enter the second number:')

print(int(x)/int(y))

except ZeroDivisionError:

print('The second number cannot be Zero')

except ValueError: #int方法抛出的是ValueError,所以使用TypeError是捕获不到异常的

print('That wasn\'t a number')

扩展资料:

Python在执行时,首先会将.py文件中的源代码编译成Python的byte code(字节码),然后再由Python Virtual Machine(Python虚拟机)来执行这些编译好的byte code。这种机制的基本思想跟Java,.NET是一致的。

然而,Python Virtual Machine与Java或.NET的Virtual Machine不同的是,Python的Virtual Machine是一种更高级的Virtual Machine。这里的高级并不是通常意义上的高级,不是说Python的Virtual Machine比Java或.NET的功能更强大,而是说和Java 或.NET相比,Python的Virtual Machine距离真实机器的距离更远。

参考资料来源:百度百科-Python

温馨提示:答案为网友推荐,仅供参考
相似回答