How to remove n from string in Python
In this article, we will see how to remove \n from string.
We can use rstrip()
to remove a trailing newline in Python.
string = "abcds\n" new_string = string.rstrip("\n") print(new_string)
Output:
abcds
Subscribe
Login
Please login to comment
0 Discussion