Hi,

I am currently learning Python and I was wondering is there a shorter
way to do the following -

import os

homedir = os.environ.get('HOME')

if homedir:
    print "My home directory is %s" % homedir


I do this in Perl -

my $home;

if ($home = $ENV{'HOME'}) { print "My home directory is $home\n"; }

Can I do a similar shortcut statement like the above in Python?


Regards,
Didar
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to