小编lnj*_*lue的帖子

'tuple'对象没有属性'rstrip'python

我正在编写一个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)

python arrays int split input

1
推荐指数
1
解决办法
813
查看次数

标签 统计

arrays ×1

input ×1

int ×1

python ×1

split ×1