I am not sure why I am getting an extra comma at the end of every output when using the Match() with Regex in python. Any ideas ? Thanks.
My Code:
import re
yyyyfile = open("yyyy.txt",'w')
text = open('final.txt')
for line in text:
x = re.match('.*?^([0-9][0-9][0-9][0-9])$.*', line)
if x:
print >> yyyyfile, x.groups()
Current Output:
('1573',)
('1595',)
('1929',)
('1933',)
Desired Output:
('1573')
('1595')
('1929')
('1933')