I am afraid that wavic it already solved for you.
if you are trying to print your header to out_file with line
Actually now I noticed that if you are using old python (pre 2.7?), then print is not function, but statement. In that case you will have to use
And if you are using python3, then your last three lines will trigger errors, because there is no print statement in python3 and you will need to add parentheses there.
if you are trying to print your header to out_file with line
print >> out_file, 'ids, text, lang, geo, place'then replace it with wavic's
print('ids, text, lang, geo, place', file=out_file)file = out_file parameter redirects printing to your file.
Actually now I noticed that if you are using old python (pre 2.7?), then print is not function, but statement. In that case you will have to use
out_file.write('ids, text, lace, geo, place\n')for "printing" to file
And if you are using python3, then your last three lines will trigger errors, because there is no print statement in python3 and you will need to add parentheses there.