<p>我想写一个.csv文件。其中一列是“单词”。每一类单词都在一行中,单元格“words”有一个单词列表,我将其读作:</p>
<pre><code>words = []
for i in range(len(category)):
r = requests.post(base_url+'/'+url[i])
if r.ok:
data = r.content.decode('utf8')
words.<a href="https://www.cnpython.com/list/append" class="inner-link">append</a>(pd.Series.tolist((pd.read_csv(io.StringIO(data), squeeze=True)).T))
url_f = [base_url + s for s in url]
df = pd.DataFrame({'category': category, 'url': url_f,
'words': words})
df.to_csv("lm_words.csv")
</code></pre>
<p>单词列表以r形式下载</p>
<p>桌子看起来像这样:</p>
^{pr2}$
<p>我正试图去掉<strong>[</strong>单词1,word2,word3<strong>]</strong>中的括号。</p>
<p>我用R写的,它不打印.csv中的括号</p>
<p>编辑1:格式</p>