File output Instructions Some coding practice. This one is straightforward. To output to a file in
Question:
File output
Instructions
Some coding practice. This one is straightforward. To output to a file in Python, we use the following syntax:
with open('file_for_output.txt', 'w') as open_file:
open_file.write('blah blah test test')
where "file_for_output.txt" can be changed to whatever you want the output file to be.
For this assignment, the name of your output file should be "Ozymandias.txt"
Output the following poem using a separate "write" command for each line of the poem below. Be sure to test your code to make sure it works.
What to submit: your Python code file; attach here
The poem to output:
Ozymandias by Percy Shelley
I met a traveller from an antique land
Who said: ‘Two vast and trunkless legs of stone
Stand in the desert. Near them, on the sand,
Half sunk, a shattered visage lies, whose frown,
And wrinkled lip, and sneer of cold command,
Tell that its sculptor well those passions read
Which yet survive, stamped on these lifeless things,
The hand that mocked them and the heart that fed.
And on the pedestal these words appear —
“My name is Ozymandias, king of kings:
Look on my works, ye Mighty, and despair!”
Accounting Information Systems
ISBN: 9780132871938
11th Edition
Authors: George H. Bodnar, William S. Hopwood