About 50 results
Open links in new tab
  1. Writing a string (with new lines) in Python - Stack Overflow

    5 You can add the \ character to the end of each line, which indicates that the line is continued on the next line, you can triple-quote the string instead of single-quoting it, or you can replace the literal …

  2. python - How do I specify new lines in a string in order to write ...

    How can I indicate a newline in a string in Python, so that I can write multiple lines to a text file?

  3. New line in python? - Stack Overflow

    Jan 5, 2011 · 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.

  4. How can I do a line break (line continuation) in Python (split up a ...

    321 From PEP 8 -- Style Guide for Python Code: The preferred way of wrapping long lines is by using Python's implied line continuation inside parentheses, brackets and braces. Long lines can be …

  5. How to create string with line breaks in Python? [duplicate]

    Jul 28, 2018 · How to create string with line breaks in Python? [duplicate] Asked 7 years, 6 months ago Modified 7 years, 6 months ago Viewed 21k times

  6. How to split a Python string on new line characters

    In Python 3 in Windows 7 I read a web page into a string. I then want to split the string into a list at newline characters. I can't enter the newline into my code as the argument in split(), becau...

  7. Writing string to a file on a new line every time - Stack Overflow

    May 27, 2010 · I want to append a newline to my string every time I call file.write(). What's the easiest way to do this in Python?

  8. How can I check for a new line in string in Python 3.x?

    Mar 4, 2011 · @ThorSummoner: Python uses universal newline mode by default i.e., platform-specific newline such as '\r\n' is translated to '\n' on input and in reverse '\n' is translated to os.linesep on …

  9. python - How can I use newline '\n' in an f-string to format a list of ...

    Jun 27, 2017 · The other answers give ideas for how to put the newline character into a f-string field. However, I would argue that for the example the OP gave (which may or may not be indicative of …

  10. Split string using a newline delimiter with Python

    If your string ends in a \n, splitlines() will ignore it while split("\n") will have an additional empty string "" at the end of the result.