How to remove n from string in Python
![how to remove n from string in python](https://pythonpoint.net/wp-content/uploads/2020/12/how-to-remove-n-from-string-in-python-1024x576.jpg)
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