Used to 'file = open(...)', now what?

Donn Cave donn at u.washington.edu
Wed May 7 19:02:40 EDT 2003


On Wed, 2003-05-07 at 13:40, Grzegorz Adam Hankiewicz wrote:
> I'm very used to the following construct:
> 
>   file = open("whatever", flags)
>
> Now what would be the "usual" way to name file variables without hiding the
> constructor?

"file" is for the file path name.

I normal use
    fp = open(file, 'r')			(file pointer)
    fd = os.open(file, os.O_RDONLY)		(file descriptor)

That's probably more common in C than Python, but more than a few
Python programmers are familiar with C.

	Donn Cave, donn at u.washington.edu




More information about the Python-list mailing list