newbie question
Paul Watson
pwatson at redlinepy.com
Wed Nov 17 10:52:38 EST 2004
"Jeremy Jones" <zanesdad at bellsouth.net> wrote in message
news:mailman.6431.1100623812.5135.python-list at python.org...
> John wrote:
>
>>Can python do Shell programming or system programming as perl does?
>>Thanks.
>>
>>John
>>
> Yes. The only problem is that the perpetual migraine you have from doing
> Perl and shell will quickly go away. So, if you're into pain, stick with
> Perl and shell. If you want relief, come to Python.
>
> Seriously, though, Python is an excellent language for doing sysadmin type
> tasks. (I'm assuming that's kind of what you wanted?) Most sysadmin type
> tasks are in modules whereas with Perl, they're cluttering the toplevel
> namespace (I don't think Perl has the concept of namespace, but you get
> the drift). So, not knowing what you want to do, you may want to checkout
> the os module in Python (I've found os.path.* to be specifically helpful).
> You may also want to checkout the shutil module.
> Jeremy
While I usually use Python, I must admit that doing:
$s = `ls -al $thefilename`
seems easier and clearer than:
import os
s = os.popen("ls -al %s" % thefilename)
More information about the Python-list
mailing list