這篇文章主要介紹了python如何將字符串list寫入excel和txt,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的登封網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!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é)果
將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é)果
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“python如何將字符串list寫入excel和txt”這篇文章對大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!
網(wǎng)頁標(biāo)題:python如何將字符串list寫入excel和txt-創(chuàng)新互聯(lián)
地址分享:http://vcdvsql.cn/article48/ddpdep.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、靜態(tài)網(wǎng)站、建站公司、網(wǎng)站營銷、域名注冊、用戶體驗(yàn)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容