-1

I have written a PYTHON code to print recommended product id's having a product id of a certain product. I am getting the output as:-

  ['503821321','503821331','504821322','503821343']

I want the output to be as:-

   503821321, 503821331, 504821322, 503821343

What should I do? Thanks in advance.

Vaibhav Sinha
  • 67
  • 1
  • 2
  • 10

2 Answers2

1
In [77]: ', '.join(['503821321','503821331','504821322','503821343'])
Out[77]: '503821321, 503821331, 504821322, 503821343'

In [78]: print(', '.join(['503821321','503821331','504821322','503821343']))
503821321, 503821331, 504821322, 503821343
inspectorG4dget
  • 110,290
  • 27
  • 149
  • 241
1
foo = ['503821321','503821331','504821322','503821343']
','.join(i for i in foo)

Output:

'503821321,503821331,504821322,503821343'
letsc
  • 2,515
  • 5
  • 35
  • 54