Skip to content

Instantly share code, notes, and snippets.

@kang8
Created December 30, 2020 08:53
Show Gist options
  • Save kang8/15e6563adeccca2104acd1c741ab7d44 to your computer and use it in GitHub Desktop.
Save kang8/15e6563adeccca2104acd1c741ab7d44 to your computer and use it in GitHub Desktop.
python parse csv and use list, dist..
import csv
dis = {}
str = set([])
with open('./assets/yikang.csv', encoding='utf-8') as f:
f_csv = csv.reader(f)
header = next(f_csv) # 获取当前指针指向的列并使指针下移一步
# 遍历剩下的文件
for row in f_csv:
str.add(row[4])
if (row[1] != ''):
url = row[1]
dis[url] = str
str = set([])
dis[url] = str
for (k, v) in dis.items():
print(k ,v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment