Is there Python equivalent to Perl BEGIN{} block?
Paddy
paddy3118 at googlemail.com
Thu Mar 13 15:25:26 EDT 2008
On Mar 13, 7:03 pm, Jonathan Gardner <jgard... at jonathangardner.net>
wrote:
> On Mar 12, 6:37 pm, Carl Banks <pavlovevide... at gmail.com> wrote:
<<Snip>>
>
> And leave out the magical -p and -n. If you want to iterate through a
> file, "for line in sys.stdin:".
Or better still:
import fileinput
for line in fileinput.input():
process(line)
- Paddy.
More information about the Python-list
mailing list