日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

python將字符串list寫入excel和txt的實(shí)例

系統(tǒng) 2130 0

docs = [‘icassp improved human face identification using frequency domain representation facial asymmetry', ‘pattern recognition unsupervised methods classification hyperspectral images low spatial resolution', ‘iscas post layout watermarking method ip protection', ‘computers mathematics applications tauberian theorems product method borel cesàro summability', ‘ieee t. geoscience remote sensing mirs all-weather 1dvar satellite data assimilation retrieval system']

將docs寫入excel

            
docs = [doc.encode('latin-1', 'ignore') for doc in docs]
# convert list to array
docs_array = np.array(docs)
print(type(docs_array))
# saving...
np.savetxt('/Users/Desktop/portrait/jour_paper_docs.csv', docs_array, fmt='%s', delimiter=',')
print('Finish saving csv file')
          

結(jié)果

python將字符串list寫入excel和txt的實(shí)例_第1張圖片

將docs寫入txt

            
def save(filename, docs):
 fh = open(filename, 'w', encoding='utf-8')
 for doc in docs:
  fh.write(doc)
  fh.write('\n')
 fh.close()
save('/Users/Desktop/portrait/jour_paper_docs.txt', docs)
          

結(jié)果

python將字符串list寫入excel和txt的實(shí)例_第2張圖片

以上這篇python將字符串list寫入excel和txt的實(shí)例就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 宜章县| 观塘区| 罗江县| 南昌市| 阿克苏市| 玉树县| 屏东县| 安图县| 许昌市| 黑山县| 乌拉特前旗| 白山市| 唐山市| 湄潭县| 石狮市| 时尚| 城固县| 万年县| 张掖市| 余江县| 泸西县| 蒙阴县| 陆良县| 宿州市| 潮安县| 镇安县| 应用必备| 怀安县| 河北区| 浮山县| 平山县| 青铜峡市| 斗六市| 时尚| 武宣县| 新宁县| 新巴尔虎右旗| 新营市| 淮滨县| 基隆市| 道孚县|