1.4 KiB
1.4 KiB
id, source_exercise_id, title, section, source_path, source_repo, source_commit, student_visible_solution, has_private_solution, skip
| id | source_exercise_id | title | section | source_path | source_repo | source_commit | student_visible_solution | has_private_solution | skip |
|---|---|---|---|---|---|---|---|---|---|
| practical-python-6.9 | 6.9 | Setting up a more complex pipeline | 6.3 Producers, Consumers and Pipelines | 06_Generators/03_Producers_consumers.md | https://github.com/dabeaz-course/practical-python | 93dca856b41c61a0a0f85ae334116e4c125629ea | false | false | false |
Exercise 6.9: Setting up a more complex pipeline
Source: Practical Python Programming,
06_Generators/03_Producers_consumers.md.
Exercise 6.9: Setting up a more complex pipeline
Take the pipelining idea a few steps further by performing more actions.
>>> from follow import follow
>>> import csv
>>> lines = follow('Data/stocklog.csv')
>>> rows = csv.reader(lines)
>>> for row in rows:
print(row)
['BA', '98.35', '6/11/2007', '09:41.07', '0.16', '98.25', '98.35', '98.31', '158148']
['AA', '39.63', '6/11/2007', '09:41.07', '-0.03', '39.67', '39.63', '39.31', '270224']
['XOM', '82.45', '6/11/2007', '09:41.07', '-0.23', '82.68', '82.64', '82.41', '748062']
['PG', '62.95', '6/11/2007', '09:41.08', '-0.12', '62.80', '62.97', '62.61', '454327']
...
Well, that's interesting. What you're seeing here is that the output of the
follow() function has been piped into the csv.reader() function and we're
now getting a sequence of split rows.