how to delete line breaks in a string python code example
Example 1: python replace newline
without_line_breaks = a_string.replace("\n", " ")
Example 2: python replace newline
from tika import parser
filename = 'myfile.pdf'
parsedPDF = parser.from_file(filename)
pdf = parsedPDF["content"]
pdf = pdf.replace('\n\n', '\n')
print (pdf)
Example 3: python remove lines of string
output_String = input_String.split("\n", 1)[1]
output_String = input_String.split("\n", 3)[1]
output_String = input_String.split("\n", 4)[0]