Python remplacer la nouvelle ligne
without_line_breaks = a_string.replace("\n", " ")
Behnam263
without_line_breaks = a_string.replace("\n", " ")
from tika import parser
filename = 'myfile.pdf'
# Parse the PDF
parsedPDF = parser.from_file(filename)
# Extract the text content from the parsed PDF
pdf = parsedPDF["content"]
# Convert double newlines into single newlines
pdf = pdf.replace('\n\n', '\n')
#####################################
# Do something with the PDF
#####################################
print (pdf)
s_lines = 'one\ntwo\nthree'
print(s_lines)
# one
# two
# three
print(s_lines.replace('\n', '-'))
# one-two-three