I want to read a text file using Python. My list must be like this:
mylist = [(-34.968398, -6.487265), (-34.969448, -6.488250), (-34.967364, -6.492370)
This code should do it:
ifile=open("data/t2mG_00", "r") lines=ifile.readlines() data=[tuple(line.strip().split()) for line in lines] print(data[0])