Python Print Array (List)

February 24, 2019
nums = [1, 2, 3, 4, 5]
print(*nums) # 1 2 3 4 5
print(*nums, sep=', ') # 1, 2, 3, 4, 5
# conver int list to str list
nums = [str(value) for value in nums]
print(' '.join(nums))   # 1 2 3 4 5
print(', '.join(nums))  # 1, 2, 3, 4, 5
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.