mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Fixed to use new Python features and use more commonly accepted style
Reindented
This commit is contained in:
parent
38e083bcc9
commit
8b6f989815
1 changed files with 18 additions and 18 deletions
|
@ -15,21 +15,21 @@ except (AttributeError, KeyError):
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mail = open(mailbox, 'r')
|
mail = open(mailbox)
|
||||||
except IOError:
|
except IOError:
|
||||||
sys.stderr.write('Cannot open mailbox file: ' + mailbox + '\n')
|
sys.exit('Cannot open mailbox file: ' + mailbox)
|
||||||
sys.exit(2)
|
|
||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
line = mail.readline()
|
line = mail.readline()
|
||||||
if not line: break # EOF
|
if not line:
|
||||||
if line[:5] == 'From ':
|
break # EOF
|
||||||
|
if line.startswith('From '):
|
||||||
# Start of message found
|
# Start of message found
|
||||||
print line[:-1],
|
print line[:-1],
|
||||||
while 1:
|
while 1:
|
||||||
line = mail.readline()
|
line = mail.readline()
|
||||||
if not line: break # EOF
|
if not line or line == '\n':
|
||||||
if line == '\n': break # Blank line ends headers
|
break
|
||||||
if line[:8] == 'Subject:':
|
if line.startswith('Subject: '):
|
||||||
print `line[9:-1]`,
|
print `line[9:-1]`,
|
||||||
print
|
print
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue