File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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...")
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 >
You can’t perform that action at this time.
0 commit comments