README.md 671 B

csv

csv 读写,python自带

Usage

写csv:

import csv

with open("xx", "w", encoding="utf-8") as f:
    writer = csv.writer(f)
    writer.writerow(["name", "url", "description"])
    for repo in self.repos:
        writer.writerow(
            [repo["name"], repo["html_url"], repo["description"]])

读csv:

with open(self.gityoqi_repo_list, "r", encoding="utf-8") as f:
    reader = csv.reader(f)
    self.repos = []
    for row in reader:
        if row[0] == "name":
            continue
        self.repos.append({
            "name": row[0],
            "html_url": row[1],
            "description": row[2]
        })

Develop

todo