reading files

bonono at gmail.com bonono at gmail.com
Mon Dec 19 05:29:54 EST 2005


Johhny wrote:
> Hello All,
>
> I am working my way through learning python as a language. I am having
> some issues with something that looks right and does not work. I am
> trying to get myself more familure with reading files. Based on the
> tutorials at www.python.org This "should" work. but im not sure what
> the issue is.
>
> ===SNIP===
> import string
>
> vsftpd=open('vsftpd.conf', 'r')
> print vsftpd
> vsftpd.read()
> vsftpd.readlines()
>
> vsftpd.close()
> ===SNIP===
>
> When I check the permissions to ensure they are correct I get the
> following.
>
> stat vsftpd.conf
>   File: `vsftpd.conf'
>   Size: 4137            Blocks: 16         IO Block: 131072 regular
> file
> Device: 802h/2050d      Inode: 51010       Links: 1
> Access: (0644/-rw-r--r--)  Uid: ( 1000/  testing)   Gid: ( 1000/
> testing)
> Access: 2005-12-19 10:21:04.000000000 +0000
> Modify: 2005-12-16 12:34:00.000000000 +0000
> Change: 2005-12-16 12:34:00.000000000 +0000
>
> When I run the script I get the following:
>
> python reading_file.py
> <open file 'vsftpd.conf', mode 'r' at 0xb7d742a8>
>
> Does anyone have any advice on this issue at all.
>
> Regards,
>
out of curiosity, what other programming background do you have prior
to use python ?




More information about the Python-list mailing list