@@ -36,7 +36,7 @@ This program does exactly what we want - it prints the average inflammation per
3636for a given file.
3737
3838~~~
39- $ python code/readings_04.py --mean data/ inflammation-01.csv
39+ $ python ../ code/readings_04.py --mean inflammation-01.csv
40405.45
41415.425
42426.1
@@ -50,14 +50,14 @@ $ python code/readings_04.py --mean data/inflammation-01.csv
5050We might also want to look at the minimum of the first four lines
5151
5252~~~
53- $ head -4 data/ inflammation-01.csv | python code/readings_04.py --min
53+ $ head -4 inflammation-01.csv | python ../ code/readings_04.py --min
5454~~~
5555{: .bash}
5656
5757or the maximum inflammations in several files one after another:
5858
5959~~~
60- $ python code/readings_04.py --max data/ inflammation-*.csv
60+ $ python ../ code/readings_04.py --max inflammation-*.csv
6161~~~
6262{: .bash}
6363
@@ -149,7 +149,7 @@ By convention this function is usually called `main`,
149149though we can call it whatever we want:
150150
151151~~~
152- $ cat readings_01.py
152+ $ cat ../code/ readings_01.py
153153~~~
154154{: .bash}
155155
@@ -172,7 +172,7 @@ and the name of the file to process from `sys.argv[1]`.
172172Here's a simple test:
173173
174174~~~
175- $ python readings_01.py inflammation-01.csv
175+ $ python ../code/ readings_01.py inflammation-01.csv
176176~~~
177177{: .bash}
178178
@@ -181,7 +181,7 @@ but haven't actually called it.
181181Let's add a call to ` main ` :
182182
183183~~~
184- $ cat readings_02.py
184+ $ cat ../code/ readings_02.py
185185~~~
186186{: .bash}
187187
@@ -204,7 +204,7 @@ if __name__ == '__main__':
204204and run that:
205205
206206~~~
207- $ python readings_02.py inflammation-01.csv
207+ $ python ../code/ readings_02.py inflammation-01.csv
208208~~~
209209{: .bash}
210210
@@ -342,7 +342,7 @@ $ cat small-01.csv
342342{: .output}
343343
344344~~~
345- $ python readings_02.py small-01.csv
345+ $ python ../code/ readings_02.py small-01.csv
346346~~~
347347{: .bash}
348348
@@ -380,7 +380,7 @@ Here's our changed program
380380`readings_03.py`:
381381
382382~~~
383- $ cat readings_03.py
383+ $ cat ../code/ readings_03.py
384384~~~
385385{: .bash}
386386
@@ -403,7 +403,7 @@ if __name__ == '__main__':
403403and here it is in action:
404404
405405~~~
406- $ python readings_03.py small-01.csv small-02.csv
406+ $ python ../code/ readings_03.py small-01.csv small-02.csv
407407~~~
408408{: .bash}
409409
@@ -436,7 +436,7 @@ These always appear before the names of the files,
436436so we could just do this:
437437
438438~~~
439- $ cat readings_04.py
439+ $ cat ../code/ readings_04.py
440440~~~
441441{: .bash}
442442
@@ -470,7 +470,7 @@ if __name__ == '__main__':
470470This works:
471471
472472~~~
473- $ python readings_04.py --max small-01.csv
473+ $ python ../code/ readings_04.py --max small-01.csv
474474~~~
475475{: .bash}
476476
@@ -499,7 +499,7 @@ before doing any processing,
499499so that the program fails fast:
500500
501501~~~
502- $ cat readings_05.py
502+ $ cat ../code/ readings_05.py
503503~~~
504504{: .bash}
505505
@@ -546,7 +546,7 @@ and so on.
546546Let's experiment in another script called `count_stdin.py`:
547547
548548~~~
549- $ cat count_stdin.py
549+ $ cat ../code/ count_stdin.py
550550~~~
551551{: .bash}
552552
@@ -569,7 +569,7 @@ but we can do almost anything with it that we could do to a regular file.
569569Let's try running it as if it were a regular command-line program:
570570
571571~~~
572- $ python count_stdin.py < small-01.csv
572+ $ python ../code/ count_stdin.py < small-01.csv
573573~~~
574574{: .bash}
575575
@@ -581,7 +581,7 @@ $ python count_stdin.py < small-01.csv
581581A common mistake is to try to run something that reads from standard input like this:
582582
583583~~~
584- $ python count_stdin.py small-01.csv
584+ $ python ../code/ count_stdin.py small-01.csv
585585~~~
586586{: .bash}
587587
@@ -600,7 +600,7 @@ so we don't actually need to change `process`.
600600Only `main` changes:
601601
602602~~~
603- $ cat readings_06.py
603+ $ cat ../code/ readings_06.py
604604~~~
605605{: .bash}
606606
@@ -641,7 +641,7 @@ if __name__ == '__main__':
641641Let's try it out:
642642
643643~~~
644- $ python readings_06.py --mean < small-01.csv
644+ $ python ../code/ readings_06.py --mean < small-01.csv
645645~~~
646646{: .bash}
647647
0 commit comments