Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python printing without commas

Tags:

python

How can I print lists without brackets and commas?

I have a list of permutations like this:

   [1, 2, 3]
   [1, 3, 2] etc.. 

I want to print them like this: 1 2 3

like image 441
ttwis Avatar asked Nov 25 '12 11:11

ttwis


People also ask

How do you print a string without commas in Python?

Use str. replace() to remove a comma from a string in Python replace(',', ”) to replace every instance of a ',' in str with ” .

How do I print a list of numbers without commas in Python?

use join() function to print array or without square brackets or commas.

How do you print a list without brackets and commas?

You can print a list without brackets and without commas. Use the string. join() method on any separator string such as ' ' or '\t' . Pass a generator expression to convert each list element to a string using the str() built-in function.

How do I remove commas from a list in Python?

You can remove comma from string in python by using string's replace() method.


1 Answers

Number_list = [1, 2, 3, 4, 5]
Print(*Number_list, sep="") # empty quote
like image 109
Edson Hungwe Avatar answered Oct 26 '22 06:10

Edson Hungwe