[英]How to remove the brackets at the beginning and the end of lines of csv files? [solved] (differences between writerow and writerows for array)
[英]How to avoid commas between each character of a string when writing on a CSV with writerow and not writerows?
您必須使用列表(即使您只有一個元素)
escritor.writerow( [ linha ] )
對於writerows
,您將需要行列表(即使您只有一行)
escritor.writerows( [ [linha] ] )
更詳細的writerow
(不帶s
)
item = 'Summary'
row = [ item ] # list with all elements in row (even if you have only one item)
escritor.writerow( row )
更詳細的writerows
(帶s
)
item = 'Summary'
row = [ item ] # list with all elements (even if you have only one item)
all_rows = [ row ] # list with all rows (even if you have only one row)
escritor.writerows( all_rows )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.