forked from dabeaz-course/practical-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise6.02.py
More file actions
45 lines (34 loc) · 776 Bytes
/
exercise6.02.py
File metadata and controls
45 lines (34 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
def countdown(n):
# Added a print statement
print('Counting down from', n)
while n > 0:
yield n
n -= 1
def printtaa():
x = countdown(10)
print(x)
print(x.__next__())
print(x.__next__())
print(x.__next__())
print(x.__next__())
print(x.__next__())
print(x.__next__())
print(x.__next__())
print(x.__next__())
print(x.__next__())
print(x.__next__())
print(x.__next__())
# printtaa()
def filematch(lines, substr):
for line in lines:
if substr in line:
yield line
from follow import follow
lines = follow('.\\Data\\stocklog.csv')
# ibm = filematch(lines, 'IBM')
# for line in ibm:
# print(line)
import csv
rows = csv.reader(lines)
for row in rows:
print(row)