|
@@ -1,3 +1,39 @@
|
|
|
# csv
|
|
|
|
|
|
-csv 读写
|
|
|
+csv 读写
|
|
|
+
|
|
|
+
|
|
|
+## 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
|