A few questions on Python.

A forum for general discussion of the Python programming language.

A few questions on Python.

Postby scriptinguy » Mon Aug 12, 2013 3:09 pm

Hi,

I know a little bit of Perl. Have written a few scripts to automate some alerts/reports in my organization.

I am a Storage Admin [EMC Storage mostly]. As it helps to know more than one scripting language, I am attempting to learn Python. Hoping it would be as fun as Perl to learn it.

Will be extremely thankful if someone could answer a few questions I have. My apologies in advance if a few (or all) questions appear dumb.

1) Most of my work involves slicing, dicing and extracting portions from command line outputs and either e-mailing the results, or putting the results in excel etc. Can I do that in Python ?

2) My work involves having the script log remotely into storage arrays through SSH. Few Google searches pointed me to Fabric and Paramiko which are used for this purpose. Thing is, getting the output is just a part of the job. Once I am in there, I need to extract certain outputs from the command line outputs so that to keep the output relevant and compact. In Perl, I do that using regex. Does Python allow me to do that?

3) Fabric/Paramiko is still not ported to Python 3, so I will be using Python 2.7, but is there anyone here who is using python 2.7 in their production environment to do automation/report extraction etc etc?

4) Will it be better to use 32 bit or 64 bit python?

5) Which is a better option? Activestate Python or MSI Installer from Python.org?

6) Any Storage/System Admins here who are using python to automate stuff in their environment?

7) And most importantly, can anyone suggest a good book targeted for Python Version 2.7?

Once again, my apologies if some of the questions here appear dumb.

Regards,
Scriptinguy
scriptinguy
 
Posts: 2
Joined: Mon Aug 12, 2013 2:52 pm

Re: A few questions on Python.

Postby stranac » Mon Aug 12, 2013 5:19 pm

scriptinguy wrote:1) Most of my work involves slicing, dicing and extracting portions from command line outputs and either e-mailing the results, or putting the results in excel etc. Can I do that in Python ?

2) My work involves having the script log remotely into storage arrays through SSH. Few Google searches pointed me to Fabric and Paramiko which are used for this purpose. Thing is, getting the output is just a part of the job. Once I am in there, I need to extract certain outputs from the command line outputs so that to keep the output relevant and compact. In Perl, I do that using regex. Does Python allow me to do that?

Yes for both of these.

scriptinguy wrote:4) Will it be better to use 32 bit or 64 bit python?

For me, it's mostly about 3rd party modules, some of them don't support 64-bit(or at least didn't when I checked, which was years ago).
Also, 64-bit might use more memory.
But, it will probably perform better, and let you use more ram.

scriptinguy wrote:5) Which is a better option? Activestate Python or MSI Installer from Python.org?

The ActiveState one has a few additional modules built-in, but you can install those separately if you need them.
So it doesn't really matter which you choose.

scriptinguy wrote:7) And most importantly, can anyone suggest a good book targeted for Python Version 2.7?

Since you already know some programming, I'd recommend just reading the official tutorial.
But if you're specifically looking for a book, I've heard How to Think Like a Computer Scientist is pretty good.
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1093
Joined: Thu Feb 07, 2013 3:42 pm

Re: A few questions on Python.

Postby scriptinguy » Tue Aug 13, 2013 3:07 pm

Hi Stranac,

Thank you very much for taking time to answer my questions.

The "How to think like a Computer Scientist" is an awesome book. Thank you for suggesting it.
scriptinguy
 
Posts: 2
Joined: Mon Aug 12, 2013 2:52 pm


Return to General Discussions

Who is online

Users browsing this forum: metulburr and 3 guests