About 8,640,000 results
Open links in new tab
  1. python string on one line - Stack Overflow

    Jan 22, 2013 · Now, if you are trying to make it one line for HTML in order to send it in an email or to past it in a webpage you can do as follow: str.replace('\n', '<br/>').replace('\r', '<br/>') But is …

  2. How to Print in the Same Line in Python [6 Methods] - Python

    Jan 29, 2024 · Print in the Same Line in Python. Here is the list of all the six methods that can be used to print in same line in Python: print() function with end parameter; print() function with …

  3. 5 Best Ways to Print on the Same Line in Python - Finxter

    Mar 7, 2024 · String concatenation involves combining strings before passing them to the print() function. This way, you generate a single string that contains all your output, which is then …

  4. python - How can I print multiple things on the same line, one at …

    Apr 8, 2011 · Without a newline, you probably want to explicitly flush the buffer. Use print("...", end="", flush=True) in Python 3, in Python 2 add a sys.stdout.flush() call. You can simply use …

  5. python - How to print one character at a time on one line

    Here's a simple trick for Python 3, since you can specify the end parameter of the print function: >>> import time >>> string = "hello world" >>> for char in string: print(char, end='') …

  6. How to make Python print one character at a time on the same line

    Apr 27, 2016 · A simple for loop will get you the individual characters from any string. The only real trick is to flush the output after each character to make it print immediately. import sys, …

  7. python - How can I put multiple statements in one line ... - Stack Overflow

    To solve the problem one can use the $'string' Bash syntax to force \n Bash interpretation before the Python one. To make the example more challenging, I added a typical Python end=..\n.. …

  8. How to print a paragraph into one single long line in python

    Jan 30, 2024 · Many (/most) terminals have linewrap enabled by default. This means if a string is longer than the width of the terminal, it will wrap over to the next line. Presuming you're using …

  9. python - Get two strings of text on the same line? - Stack Overflow

    Jul 31, 2013 · You can also put all your string in one string like that : >>> string = 'abc' + 'def' >>> print string 'abcdef'

  10. 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 …

  11. Some results have been removed
Refresh