I have a file with the first two lines looking like this:
(1,233)(44,444)(2323,545)(0,0)(22,2)(5,0)(222,2)(0,5)(12,2)(22,3)
(0,223)(44,424)(123,545)(0,1)(42,2)(5,0)(52,2)(0,6)(17,4)(3,3)
I want to read each tuple and get each number (without the commas and parenthesis). I read like this:
file = filedialog.askopenfilename(filetypes=[("Text files","*.txt")])
if file is None:
return False
with open(file, 'r') as f:
lines = f.read().split("\n")
firstLine = lines[0]
secondLine = lines[1]
# Run loop here to get the tuple values
# firstNum = tuple[0]
# secondNum = tuple[1]
# Go to next line and do the same
How can I go about doing the above? Any help would be appreciated.