Skip to main content
 首页 » 编程设计

python之如何解析下面的 .txt 文件

2025年05月04日15lyj

<分区>

|2014|,|H0AK00097|,|N00032846|,|John Cox (R)|,|R|,|AK01|,|    |,| |,|Y|,|C|,|RL|,| | 

我正在通过以下代码读取 .txt 文件中的上一行。

with open("E:\campaign_finance\CampaignFin14\cands14.txt", "r+") as f: 
         data = list(csv.reader(f)) 

有没有办法通过同时删除 | 来读取这一行。