Python 将列表写入csv文件时删除括号和倒引号

Python 将列表写入csv文件时删除括号和倒引号,python,list,python-3.x,csv,Python,List,Python 3.x,Csv,我目前正在将列表写入csv文件。我做得对。 (假设)我的工作看起来像这样: stuff = [34,87,34,43,23,32] with open("typer.txt", "w") as myTyper: myTyperSpells = csv.writer(myTyper) myTyperSpells.writerow([stuff]) "[34, 87, 34, 42, 23, 32]" 此列表已成功写入文本文件“typer”。然而,它看起来是这样的: stuff

我目前正在将列表写入csv文件。我做得对。 (假设)我的工作看起来像这样:

stuff = [34,87,34,43,23,32]
with open("typer.txt", "w") as myTyper:
    myTyperSpells = csv.writer(myTyper)
    myTyperSpells.writerow([stuff])
"[34, 87, 34, 42, 23, 32]"
此列表已成功写入文本文件“typer”。然而,它看起来是这样的:

stuff = [34,87,34,43,23,32]
with open("typer.txt", "w") as myTyper:
    myTyperSpells = csv.writer(myTyper)
    myTyperSpells.writerow([stuff])
"[34, 87, 34, 42, 23, 32]"
是否可以删除倒逗号、方括号和空格,使其在文本文件中显示为这样

34,87,34,42,23,32

任何帮助都会很有用…谢谢

写入行时,删除
stuff
周围的方括号

例如


事实上,您正在将您的列表放入另一个列表中

谢谢—我不知道它有这么简单!:D