我有一个简单的Python脚本,在Jupyter Notebook中运行。然而,我传递给它的参数似乎被忽略了,这导致了异常:
two_digits.py
import sys
input = sys.stdin.read()
tokens = input.split()
a = int(tokens[0])
b = int(tokens[1])
print(a + b)
%run two_digits 3 5
ndexError Traceback (most recent call last)
D:\Mint_ns\two_digits.py in <module>()
5 tokens = input.split()
6
----> 7 a = int(tokens[0])
8
9 b = int(tokens[1])
IndexError: list index out of range