arrays - 'tuple' object has no attribute 'rstrip' python -


i writing python program takes in user input int array later sorted. have compiled program on machine, however, cannot compile correctly on unix server. python compiler on machine version 3 while believe server may running on python 2.6. i'm not sure underlying issue.

list = input('enter numbers in array commas: ').rstrip() #this line being flagged list = list.split(',') print(list) 

my error:

 attributeerror: 'tuple' object has no attribute 'rstrip' 

you using python2, in input() equivalent eval(raw_input()). evaluating input (which suppose 1, 2) tuple - has no rstrip attribute.

fix code using raw_input instead of input. give string can use rstrip on.

i'd suggest use variable name in place of list because shadow built in list.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -