Reputation: 43667
Want to find piece of the code, written in python, which adds a new line inside some function.
For which character I have to search? For \n
?
Thanks.
Upvotes: 4
Views: 36764
Reputation: 97
In order to add a new line in a python string you use \n
for example:
#Code
string = "Hello\nWorld"
print(string)
#Result
Hello
World
Upvotes: 1
Reputation: 2484
The newline you are looking for might be added implicitly: watch out for Python's print statement. It automatically adds a newline if the last argument is not followed by a comma.
Upvotes: 2
Reputation: 42208
Yes, in strings usually \n
is used. However, it might be multi line string like this:
'''
Some string
with
enters.
'''
Upvotes: 6