[Tutor] File mode tests (original) (raw)
Bill Campbell bill at celestial.net
Fri Jul 30 20:16:47 CEST 2004
- Previous message: [Tutor] File mode tests
- Next message: [Tutor] File mode tests
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Jul 30, 2004, Steve wrote:
Hi Bill,
On Thu, 29 Jul 2004 17🔞15 -0700, Bill Campbell <bill at celestial.net> wrote: I'm just getting my feet wet with python after programming primarily in perl since perl-3.something. Welcome to the other side :)
I've read the Harms and McDonald ``The Quick Python Book'', and O'Reilly's ``Learning Python'', but haven't been able to find python equivalents to these perl tests (lots of others in os.path, but not these :-).
if ( -x path ) # is is executable if ( -r path ) # is it readable if ( -w path ) # is it writeable The function os.access() povides these, have a look here: http://python.org/doc/current/lib/os-file-dir.html
Thanks for the reference.
I would love to find documentation, something like ``python for the perl hacker'' that would help in the transition. So would a lot many hackers who see the light :) ....here you go (urls may wrap): http://www.onlamp.com/pub/a/onlamp/2002/06/27/pythonandperl.html http://www.minihttpserver.net/showasin/CatcbookEnperltopythonmigration-0201734885.htm HTH Steve PS: forgive the cheeky-ness ....couldn't help myself :o)
Not a problem. I've been known to make a few similar comments myself.
One of my major issues with python isn't the language per se, but the fact that I'm very dependent on vim/vi's ability to match braces using the ``%'' key which makes navigating source code very easy (don't say use emacs -- as many times as I've tried it, my fingers have 22 years of vi habits :-). My solution for this with shell programming has been to use comments #{ and #} around control flow blocks which works with python as well, but probably would drive a python purist nuts.
Bill
INTERNET: bill at Celestial.COM Bill Campbell; Celestial Systems, Inc. UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 URL: http://www.celestial.com/
There is no distinctly native American criminal class save Congress -- Mark Twain
- Previous message: [Tutor] File mode tests
- Next message: [Tutor] File mode tests
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]