0

Hello,

I have a huge file with the following kind of lines:

A,B,C 1,2,3
D,E 4,5

What is efficient way to split and get the following output using python?

A 1
B 1
C 1
A 2
B 2
C 2
A 3
B 3
C 3
D 4
D 5
E 4
E 5

Any help appreciated.

Thank you
S

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by sanchow
0

Can you explain the details of the file you want to split?

if each line is like this:
"A,B,C 1,2,3",
you can do str.split(" ")
and you'll get:
["A,B,C","1,2,3"]
and do another str.split(",")
and you'll have nice organized lists
and go from there

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.