without_line_breaks = a_string.replace("
", " ")
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('
', '
')
#####################################
# Do something with the PDF
#####################################
print (pdf)
>>> import re
>>> re.sub('
?
', ' $ ', 'a
b
c')
'a $ b $ c'
>>> re.sub('
?
', ' $ ', 'a
b
c')
'a $ b $ c'
#Just print the text and copy from console
print(f"A
B
C")
#output:
# A
# B
# C