I have a list in a file, looks like this
c4a24534,2434b375,e750c718, ....
I have split at \",\" and brought the below list.
x
Assuming this is a contents of input.txt
file:
c4a24534,2434b375,e750c718
Use zip() for splitting into two lists:
with open('input.txt') as f:
i, q = zip(*((x[:4], x[4:]) for line in f for x in line.split(',')))
print i
print q
Prints:
('c4a2', '2434', 'e750')
('4534', 'b375', 'c718')
These are tuples, if you need to make lists from them, call list()
on each:
print list(i)
print list(q)