Printing an int list in a single line python3

前端 未结 10 1402
臣服心动
臣服心动 2020-12-03 01:16

I\'m new to python and I\'m trying to scan multiple numbers separated by spaces (let\'s assume \'1 2 3\' as an example) in a single line and add it to a list of int. I did i

10条回答
  •  难免孤独
    2020-12-03 01:29

    Try using join on a str conversion of your ints:

    print ' '.join(str(x) for x in array)
    

提交回复
热议问题