Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Related Rants
How would I use \n in Python as a string?
Use Examples:
If you are making a string calculator, and using \n to separate the numbers/text from each other and put them individually into a list, which the conclusion for example:
24\n10\nhi
This should get a list like this:
[ '24', '10', 'hi']
What is the solution?
We can simply use one of the following solutions:
r"\n"
OR
"\\n"
Code example:
rant
python