Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # #!/usr/bin/python
- #
- # By dvdjaco
- # Exercise 8.3
- #
- # Rewrite the guardian code in the above example without two if statements.
- # Instead use a compound logical expression using the and logical operator with # a single if statement.
- #
- # R: with the 'and' statement? Seems better to use 'or' (actually can't think of a use of 'and' that would accomplish the same)
- fhand = open('mbox-short.txt')
- for line in fhand:
- words = line.split()
- # print 'Debug:', words
- if len(words) == 0 or words[0] != 'From' : continue
- print words[2]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement