Created
May 16, 2020 10:32
-
-
Save ohr-emet/6cc3481856dea2c6981cbab11c7d542f to your computer and use it in GitHub Desktop.
py4e - Ch 7 Files: Ex1 [convert to upper]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Write a program to read through a file and print the contents of the file (line by line) all in upper case. Executing the program will look as follows: | |
python shout.py | |
Enter a file name: mbox-short.txt | |
FROM [email protected] SAT JAN 5 09:14:16 2008 | |
RETURN-PATH: <[email protected]> | |
RECEIVED: FROM MURDER (MAIL.UMICH.EDU [141.211.14.90]) | |
BY FRANKENSTEIN.MAIL.UMICH.EDU (CYRUS V2.3.8) WITH LMTPA; | |
SAT, 05 JAN 2008 09:14:16 -0500 | |
''' | |
fhand = open(r'C:\Users\AT\Desktop\py4e\Projects\Ch 7\mbox-short.txt') | |
for line in fhand: | |
ly = line.rstrip() | |
print(ly.upper()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
open(r'C:\Users\AT\Desktop\py4e\Projects\Ch 7\mbox-short.txt')