python: printing horizontally rather than current default printing

前端 未结 10 2070
孤城傲影
孤城傲影 2021-02-05 06:32

I was wondering if we can print like row-wise in python.

Basically I have a loop which might go on million times and I am printing out some strategic counts in that loop

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-05 07:10

    Python 3:

    l = [3.14, 'string', ('tuple', 'of', 'items')]
    print(', '.join(map(repr, l)))
    

    Output:

    3.14, 'string', ('tuple', 'of', 'items')
    

提交回复
热议问题