I am printing lines from a file on the terminal using the print statement. But it prints the newline ("\n") along with the text. How can I drop newline while using the print statement?
You can use the print statement with parameter end="". It will drop the newline from the record.
Here is an example:
>>> with open("pu.txt", "r") as fin:... for line in fin:... print(line, end="")...import numpy as npimport pandas as pdfrom cleanlab.latent_estimation import estimate_latentfrom cleanlab.latent_estimation import compute_confident_jointfrom cleanlab.classification import LearningWithNoisyLabelsfrom cleanlab.pruning import get_noise_indices