Python Forum
help with commas in print functions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help with commas in print functions
#11
Another simple approach is to use sep and end as arguments in your print statement
first = 1
second = 3
third = 2
print("The input numbers are ",end="")
print(first, second, third, sep=", ")
Output:
The input numbers are 1, 3, 2
which also works in pre-f string versions of Python
Reply


Messages In This Thread
RE: help with commas in print functions - by Yoriz - Oct-12-2021, 08:46 AM
RE: help with commas in print functions - by buran - Oct-12-2021, 11:55 AM
RE: help with commas in print functions - by jefsummers - Oct-12-2021, 01:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Commas issue in variable ddahlman 6 521 Apr-05-2024, 03:45 PM
Last Post: deanhystad
  Print different positions in loop from functions konsular 5 2,786 Oct-16-2019, 08:10 PM
Last Post: buran
  Help|CSV Writing on List with Inner Commas soothsayerpg 2 2,402 Jul-20-2019, 06:59 AM
Last Post: scidam
  [split] Automate the boring stuff, inserting commas in list srikanth 1 2,146 Jul-02-2019, 02:29 PM
Last Post: metulburr
  Automate the boring stuff, inserting commas in list DJ_Qu 3 4,774 Apr-21-2019, 03:52 PM
Last Post: perfringo
  accessing array without commas rjnabil1994 1 2,545 Feb-10-2019, 06:29 PM
Last Post: Larz60+
  Printing array without commas pawlaczkaj 1 9,515 Apr-08-2018, 07:05 PM
Last Post: Larz60+
  How to remove empty line between two print functions BigEasy 1 2,398 Feb-07-2018, 08:38 AM
Last Post: buran

Forum Jump:

User Panel Messages

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