Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8b6f9898
Commit
8b6f9898
authored
Feb 20, 2001
by
Moshe Zadka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed to use new Python features and use more commonly accepted style
Reindented
parent
38e083bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
Demo/scripts/from.py
Demo/scripts/from.py
+18
-18
No files found.
Demo/scripts/from.py
View file @
8b6f9898
...
...
@@ -9,27 +9,27 @@ import sys, os
# Open mailbox file. Exits with exception when this fails.
try
:
mailbox
=
os
.
environ
[
'MAIL'
]
mailbox
=
os
.
environ
[
'MAIL'
]
except
(
AttributeError
,
KeyError
):
sys
.
stderr
.
write
(
'No environment variable $MAIL
\
n
'
)
sys
.
exit
(
2
)
sys
.
stderr
.
write
(
'No environment variable $MAIL
\
n
'
)
sys
.
exit
(
2
)
try
:
mail
=
open
(
mailbox
,
'r'
)
mail
=
open
(
mailbox
)
except
IOError
:
sys
.
stderr
.
write
(
'Cannot open mailbox file: '
+
mailbox
+
'
\
n
'
)
sys
.
exit
(
2
)
sys
.
exit
(
'Cannot open mailbox file: '
+
mailbox
)
while
1
:
line
=
mail
.
readline
()
if
not
line
:
break
# EOF
if
line
[:
5
]
==
'From '
:
# Start of message found
print
line
[:
-
1
],
while
1
:
line
=
mail
.
readline
()
if
not
line
:
break
# EOF
if
line
==
'
\
n
'
:
break
# Blank line ends headers
if
line
[:
8
]
==
'Subject:'
:
print
`line[9:-1]`
,
print
line
=
mail
.
readline
()
if
not
line
:
break
# EOF
if
line
.
startswith
(
'From '
):
# Start of message found
print
line
[:
-
1
],
while
1
:
line
=
mail
.
readline
()
if
not
line
or
line
==
'
\
n
'
:
break
if
line
.
startswith
(
'Subject: '
):
print
`line[9:-1]`
,
print
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment