Python Forum
How to make for loop display on 1 Line
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make for loop display on 1 Line
#4
(Jan-12-2022, 08:55 PM)bowlofred Wrote: Or, just tell print() to not include the newline.

import sys
import time

response = "Hello there..."
print ("Baxter: ", end="")
for i in response:
    sys.stdout.write(i)
    sys.stdout.flush()
    time.sleep(0.2)

Thanks!
The
end=""
solved it.
Reply


Messages In This Thread
How to make for loop display on 1 Line - by Extra - Jan-12-2022, 08:40 PM
RE: How to make for loop display on 1 Line - by Extra - Jan-12-2022, 09:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to display <IPython.core.display.HTML object>? pythopen 3 46,014 May-06-2023, 08:14 AM
Last Post: pramod08728
  Trying to loop through code to plot seaborn line plots across multiple subplots eyavuz21 0 1,697 Dec-05-2022, 10:46 AM
Last Post: eyavuz21
  Skipping line in text without Restarting Loop IdMineThat 4 1,503 Apr-05-2022, 04:23 AM
Last Post: deanhystad
  How to prevent python from going to new line in for loop? idknuttin 3 4,961 Feb-11-2022, 05:40 AM
Last Post: deanhystad
  Looking for discord bot to make loop ping for address ip tinkode 0 1,836 Jul-26-2021, 03:51 PM
Last Post: tinkode
  How to make input come after input if certain line inserted and if not runs OtherCode Adrian_L 6 3,356 Apr-04-2021, 06:10 PM
Last Post: Adrian_L
Information Unable to display joystick's value from Python onto display box MelfoyGray 2 2,251 Nov-11-2020, 02:23 AM
Last Post: MelfoyGray
  For loop to make it easier Amirdst 2 2,073 Apr-28-2020, 04:12 PM
Last Post: Yoriz
  How to make input goto a different line mxl671 2 2,472 Feb-04-2020, 07:12 PM
Last Post: Marbelous
  How to Display Multiple Time Tables With While Loop ZQ12 2 2,185 Nov-10-2019, 04:15 AM
Last Post: ZQ12

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020