Read a Txt File Without Newlines n in Python
Question:
Get txt File content Without the n or t ; here is the code:
pos = requests.get(url,headers=headers)
print("content-type: text/htmlnn")
print(pos.content)
Output:
nn
some text here some text here
nn
some text here some text here
nn
Answers:
When you call a new print statement, the string will be printed on a newline. For it to be on the same line, you can use string formatting.
print("content-type: text/htmlnn{}".format(post.content))
Get txt File content Without the n or t ; here is the code:
pos = requests.get(url,headers=headers)
print("content-type: text/htmlnn")
print(pos.content)
Output:
nn
some text here some text here
nn
some text here some text here
nn
When you call a new print statement, the string will be printed on a newline. For it to be on the same line, you can use string formatting.
print("content-type: text/htmlnn{}".format(post.content))