About 50 results
Open links in new tab
  1. How do I create a multiline Python string with inline variables?

    I'm looking to see if there is something similar to $ in Perl to indicate a variable in the Python syntax. If not - what is the cleanest way to create a multiline string with variables?

  2. python - How do I split the definition of a long string over multiple ...

    This is "Pythonic way to create multi-line code for a long string" To create a string containing newlines see textwrap.dedent.

  3. python - Multi line string with arguments. How to declare ... - Stack ...

    Here's a basic example of using both the "pretty" and the "ugly" multi-line string methods presented above in order to get the best benefits of each. This also shows how to use and print module …

  4. python - How do I split a multi-line string into multiple lines ...

    I have a multi-line string that I want to do an operation on each line, like so: inputString = """Line 1 Line 2 Line 3""" I want to iterate on each line: for line in

  5. Is it possible to break a long line to multiple lines in Python?

    In Python code, it is permissible to break before or after a binary operator, as long as the convention is consistent locally. For new code Knuth's style (line breaks before the operator) is suggested.

  6. How to correctly write a raw multiline string in Python?

    Nov 17, 2017 · The triple quotes are used to create a multi-line string (string that contains newlines). Concatenating and escaping are used to create a multi-line code representation of a single-line string.

  7. Concatenate strings in python in multiline - Stack Overflow

    To split a long string to multiple lines surround the parts with parentheses (()) or use a multi-line string (a string surrounded by three quotes """ or ''' instead of one).

  8. python - Print multiline string variable without indent - Stack Overflow

    Nov 30, 2016 · Sometimes I want to indent the multi-line string because it is inside a code block that already has indent. A multi-line string without indent would make the code harder to read.

  9. How to print multiple lines of text with Python - Stack Overflow

    Nov 11, 2023 · If I wanted to print multiple lines of text in Python without typing print('') for every line, is there a way to do that? I'm using this for ASCII art in Python 3.5.1.

  10. python - Proper indentation for multiline strings? - Stack Overflow

    Other than that, multiline string literals in Python are unfortunately what-you-see-is-what-you-get in terms of whitespace: all characters between the string delimiters become part of the string, including …