Reading in a file
clp2 at rebertia.com
Mon Apr 12 20:49:08 CEST 2010
On Mon, Apr 12, 2010 at 11:31 AM, Maggie <la.foma at gmail.com> wrote:
> 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:
> import sys
> feed = sys.stdin.readlines()
This sounds like homework, so here are some clues:
sys.stdin is a file object.
open('/path/to/file.here', '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