-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
  • 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
  • 104,525
  • 25
  • 135
  • 234
1
foo = ['503821321','503821331','504821322','503821343']
','.join(i for i in foo)

Output:

'503821321,503821331,504821322,503821343'
letsc
  • 2,442
  • 3
  • 30
  • 52