I use Python3 and write result into a file like this:
with open(output,'w') as f: f.write('Line count of the log files is: ' + str(line_count) + '. \n')
f.write() automatically returns # of characters written, is there a way to do not output it? I ask this because I do not want it output.
This is not unique to
file.write(). The interactive interpreter prints the result of any evaluated expression that does not result in
>>> for i in range(3): ... i # expression evaluates to the value of i ... 0 1 2 >>>
Two things to note. First, these won't be displayed when you are not using the interactive interpreter, so it's safe to ignore.
Second, you can make the display go away by assigning the result. That turns the expression into a statement.
>>> for i in range(3): ... _ = i # underscore is a nice meaningless variable name ... >>>