Skip to content

Commit c085b2d

Browse files
committed
I made regular print statements and replaced the previous ones that used f
1 parent b365bc6 commit c085b2d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

source/ch8_filehandling.ptx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,15 @@
128128
<program xml:id="creat-file-exp-2" interactive="activecode" language="python">
129129
<code>
130130
filename = "newfile.txt"
131-
print(f"Attempting to write to '{filename}' using 'w' mode...")
131+
print("Attempting to write to '" + filename + "' using 'w' mode...")
132132
try:
133133
with open(filename, 'w') as f:
134134
f.write("This file was created using 'w' mode.")
135-
print(f"SUCCESS: The file '{filename}' was created or overwritten.")
135+
print("SUCCESS: The file '" + filename + "' was created or overwritten.")
136136
except Exception as e:
137137
# This would only catch other unexpected errors
138-
print(f"An unexpected error occurred during write: {e}")
138+
print("An unexpected error occurred during write: " + str(e))
139+
139140
</code>
140141
</program>
141142

0 commit comments

Comments
 (0)