File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 6
6
__author__ = 'Chongsen Zhao'
7
7
8
8
from csv import reader
9
+ from zipfile import ZipFile
10
+ from io import TextIOWrapper
9
11
10
12
11
13
class Person :
@@ -85,13 +87,23 @@ def append(self, target):
85
87
86
88
ring = RingSort ()
87
89
88
- f_csv = open ("people.csv" )
90
+ f_zip = ZipFile ('people.zip' )
91
+ f_csv = TextIOWrapper (f_zip .open ('people.csv' ))
89
92
data = reader (f_csv )
90
93
for line in data :
91
94
name = line [0 ]
92
95
age = line [1 ]
93
96
ring .append (Person (name , age ))
94
97
f_csv .close ()
98
+ f_zip .close ()
99
+
100
+ # f_csv = open("people.csv")
101
+ # data = reader(f_csv)
102
+ # for line in data:
103
+ # name = line[0]
104
+ # age = line[1]
105
+ # ring.append(Person(name, age))
106
+ # f_csv.close()
95
107
96
108
# f_txt = open("people.txt")
97
109
# for line in f_txt:
You can’t perform that action at this time.
0 commit comments