Reading in a file

Chris Rebert clp2 at
Mon Apr 12 14:49:08 EDT 2010

On Mon, Apr 12, 2010 at 11:31 AM, Maggie <la.foma at> wrote:
> hello,
> i have a basic script i need to implement. i need below code to read
> in a file and perform operation is it designed to do:
> #!/usr/bin/python
> import sys
> feed = sys.stdin.readlines()

This sounds like homework, so here are some clues:
sys.stdin is a file object.
open('/path/to/', 'r') creates a new readable file object
representing the file at the given path.

You should be able to figure it out from there.


More information about the Python-list mailing list