jeudi 22 janvier 2015

How to split a line and map it in pairs?


Vote count:

0




I am trying to transform a file into (key,value) pair. Each line is given as 1 A B C D 2 3 E 4 F G


and I want to pair them as (1,A),(1,B),(1,C),(1,D),(3,E),(4,F),(4,G)


I was trying to do this in python but couldn't come up with a solution, unless I read the file line by line and use loop to do that.



asked 1 min ago







How to split a line and map it in pairs?

Aucun commentaire:

Enregistrer un commentaire