Skip to content

Commit 97dc160

Browse files
committed
fixed python block in 8.3
1 parent b4a0293 commit 97dc160

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

source/ch8_filehandling.ptx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
First, lets look at the equivalent Python code:
126126
</p>
127127

128-
<program xml:id="creat-file-exp-2" interactive="activecode" language="python" add-files="my-file-8-2-2">
128+
<program xml:id="creat-file-exp-2" interactive="activecode" language="python">
129129
<code>
130130
filename = "newfile.txt"
131131
print(f"Attempting to write to '{filename}' using 'w' mode...")
@@ -248,9 +248,9 @@
248248
The next lines consists of a Python code example that reads each line of the file passed to the Scanner object.:
249249
</p>
250250

251-
<program interactive="activecode" language="python">
251+
<program interactive="activecode" language="python" add-files="my-file">
252252
<code>
253-
with open("filename.txt", "r") as file_reader:
253+
with open("myfile.txt", "r") as file_reader:
254254
for line in file_reader:
255255
print(line.strip())
256256
</code>

0 commit comments

Comments
 (0)