我正在编写一个python程序,它接受一个后来排序的int数组的用户输入.我已经在我的机器上成功编译了我的程序,然而,无法在Unix服务器上正确编译它.我的机器上的Python编译器是版本3,而我相信服务器可能在Python 2.6上运行.我不确定底层问题是什么.
list = input('Enter numbers in array with commas: ').rstrip() #this line is being flagged
list = list.split(',')
print(list)
Run Code Online (Sandbox Code Playgroud)
我的错误:
AttributeError: 'tuple' object has no attribute 'rstrip'
Run Code Online (Sandbox Code Playgroud)