I'm using a python code with the following code :
sys.stdout.write("{}\t".format(leaf_distances[n][m]))
I just wondered if someone knew a way to replace sys.stdout.write
by a print
argument ?
So far I tried:
print("{}\t".format(leaf_distances[n][m]))
but it does not seem to be the same thing.
CodePudding user response:
The closest equivalent is print
that does not add a line break at the end of the output. New-style formatting:
print(f"{leaf_distances[n][m]}\t", end="")
Old-style formatting:
print("{}\t".format(leaf_distances[n][m]), end="")
CodePudding user response:
You'd want
print(str(leaf_distances[n][m]), end="\t")
for an equivalent.