[英]Printing a list as a string without parentheses or commas in python
我有一個循環創建的列表:: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
。
我要打印
0 1 2 3 4 5 6 7 8 9
我已經使用.strip('[]')
擺脫了括號,但我無法擺脫逗號。
您可以使用另一個循環來執行此操作,並在print
后使用逗號:
for e in your_list:
print e,
注意:逗號將避免打印換行符。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.