Perl to Python again

Fillmore fillmore_remove at hotmail.com
Fri Mar 11 18:42:24 EST 2016


So, now I need to split a string in a way that the first element goes 
into a string and the others in a list:

while($line = <STDIN>) {

     my ($s, at values)  = split /\t/,$line;

I am trying with:

for line in sys.stdin:
     s,values = line.strip().split("\t")
     print(s)

but no luck:

ValueError: too many values to unpack (expected 2)

What's the elegant python way to achieve this?

Thanks



More information about the Python-list mailing list