Python Forum
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Print in single line
#1
This print in multiple lines

for i in range(1,9):
   print(i)
This print in single line concatenated
for i in range(1,9):
   print(i),
I need print in single line replacing the previous output. to use a single line when i'm output a list of value to be comparated,
for example when iterating in file name list of my disc in search of specific one

Some idea?
Reply
#2
for i in range(1,9):
   print('{}'.format(i), end='')
print()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  problem with spliting line in print akbarza 3 335 Jan-23-2024, 04:11 PM
Last Post: deanhystad
  Print the line before the corrent line tester_V 9 1,489 Nov-18-2022, 08:39 AM
Last Post: Gribouillis
  Print to a New Line when Appending File DaveG 0 1,190 Mar-30-2022, 04:14 AM
Last Post: DaveG
  Presenting multiline data into single line aaronbuhu 1 1,771 Aug-05-2021, 10:57 AM
Last Post: jamesaarr
  beginner text formatting single line to column jafrost 4 3,161 Apr-28-2021, 07:03 PM
Last Post: jafrost
  If match not found print last line tester_V 2 2,846 Apr-26-2021, 05:18 AM
Last Post: tester_V
  print a line break in writelines() method leodavinci1990 1 6,364 Oct-12-2020, 06:36 AM
Last Post: DeaD_EyE
  Print characters in a single line rather than one at a time hhydration 1 1,991 Oct-10-2020, 10:00 PM
Last Post: bowlofred
  How to print string multiple times on new line ace19887 7 5,574 Sep-30-2020, 02:53 PM
Last Post: buran
  Using lambdas and map() to parse substrings in a single line Drone4four 5 2,972 Sep-20-2020, 10:38 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

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