About 15,200,000 results
Open links in new tab
  1. string - Wrap long lines in Python - Stack Overflow

    How do I wrap long lines in Python without sacrificing indentation? For example: def fun(): print '{0} Here is a really long sentence with {1}'.format(3, 5)

  2. Write a Long String on Multiple Lines in Python | note.nkmk.me

    May 14, 2023 · In Python, you can freely break lines inside parentheses ((), {}, []). You can use this rule to split a long string into multiple lines using parentheses instead of backslashes. …

  3. Multiline String in Python - GeeksforGeeks

    Jul 24, 2024 · Using the triple quotes style is one of the easiest and most common ways to split a large string into a multiline Python string. Triple quotes (''' or """) can be used to create a …

  4. Write a Long String on Multiple Lines in Python - Finxter

    Aug 7, 2023 · To create and manage multiline strings in Python, you can use triple quotes and backslashes, while more advanced options involve string literals, parentheses, the + operator, …

  5. Top 4 Methods to Format Long Strings in Python Without

    Nov 24, 2024 · Learn how to efficiently wrap long strings in Python without breaking words using various methods like textwrap and regex.

  6. Pythonic way of printing multi-line strings - Python Help

    Oct 4, 2022 · The preferred way of wrapping long lines is by using Python’s implied line continuation inside parentheses, brackets and braces. Long lines can be broken over multiple …

  7. Mastering Long Strings in Python

    Aug 26, 2024 · Long strings allow you to define multi-line strings without the need to escape newline characters (\n) at the end of each line. They are defined using triple quotes (''' ''' or """ …

  8. Python Strings - Python Guides

    Use f-strings for formatting when targeting Python 3.6+ For very long strings, consider using multi-line strings ... Count and Display Vowels in a String in Python; Print Alternate Characters in a …

  9. Python Program to Create a Long Multiline String

    You can use '''(multiline string)''' or """(multiline string)""" to print a multiline string as shown above. Example 2: Using parentheses and a single/double quotes my_string = ("The only way to \n" …

  10. How to declare a long string in Python? - Stack Overflow

    Dec 20, 2011 · long_string = 'fooo' \ 'this is really long' \ 'string' or if you need linebreaks. long_string_that_has_linebreaks = '''foo this is really long '''

Refresh