I am using the following commands inside a Loop to open a .txt file and write some results on the file.
with open ('results.txt', 'a') as file:
file.write('%s %d %s %s \n' %(timestamp, v, str(dcur), str(gcur)))
However, the results are not printed on the same line at the .txt file and str(gcur) appears on the next one.
Why does this happen and how could it be solved?
(timestamp, v, str(dcur).rstrip("\n"), str(gcur).rstrip("\n")))\nin your stringsgcur and dcur, then it should not happen. Could you give a complete example with inputs and outputs? Thanks