Newbie Here

M

Mark Sargent

Hi All,

I'm taking the plunge into Python. I'm currently following this tutorial,
http://docs.python.org/tut/
I am not a programmer in general, although I've learnt a bit of bash
scripting and some php/asp. I want to get into python to use it for
Linux/Unix related stuff. A question I have, is, those of you who use it
for the same things, what do you primarily use it for. Could you show me
some examples.? I find the hardest thing with programming, is not
remember the syntax/logic etc, but, when to use it. Perhaps that is also
a personal thing, but, I'd love to see some basic examples out there.
Cheers.

Mark Sargent.
 
P

Peter Maas

Mark said:
I want to get into python to use it for
Linux/Unix related stuff. A question I have, is, those of you who use it
for the same things, what do you primarily use it for. Could you show me
some examples.?

- little daily stuff e.g. transforming data
- sysadmin tasks (backup scripts)
- web applications (replacing asp/php)
 
R

raviteja.bhupatiraju

Not sure what you mean Unix related stuff. Anything can be.

I use Python as a general purpose language. Python is good for most
things I do.
Recently I used it for Web Applications (CherryPy), Search Engines
(Lupy, PyLucene), Middleware (Ice), Swing GUIs (Jython), data
transformations etc.
 
R

Rob Cowie

As a relalative newbie myself I think I can say Python is used for
anything any major programming language is used for. One of its many
strengths is scalability - it can be used to great effect as a
scripting language AND as an object oriented language for creating
large, GUI apps.

Yours is not an easy question to answer - there are as many uses for
python as there are 'computing tasks'.

Go to http://www.awaretek.com/tutorials.html for a load of tutorials
and examples
 
P

Peter Maas

Rob said:
As a relative newbie myself I think I can say Python is used for
anything any major programming language is used for.

My list was meant as an enumeration of tasks for which _I_ _currently_
use Python. You are of course right that Python covers a much wider
range, although "anything any major programming language is used for"
is probably too wide. I would e.g. exclude device drivers, router
firmware etc. ;)
 
M

Magnus Lycka

Mark said:
A question I have, is, those of you who use it
for the same things, what do you primarily use it for.

Erh, I'm sure different people use it for very different things.
In contrast to e.g. PHP or bash, Python is a very generic language
usable for most preogramming tasks. My answer would be "almost
everything when I need to do programming or calculate something".
I mainly complement Python with some SQL for work with databases
and C/C++ for performance, some integration, or when I have to,
due to "external forces". Actually, it's almost always the third
reason. It's very rare that I skip Python for performance reasons.

Note that Python is a very good "team player". It's often not a
matter of using Python OR [insert some other language] but rather
Python AND [insert some other language]. Of course, some languages,
such as Perl and Ruby are reasonably similar to Python, and using
them together will probably add little. I guess the Python/SQL/C/C++
combo is fairly common.

People use Python for various small scripts, for major business
applications, many different web systems, for image processing
(for everything from weather maps to Star Wars animations), as
embedded macro language in large applications, as a programmable
calculator, for data integration and conversion etc etc.

For a "business case" perspective on Python, look at www.pythonology.com
For coding examples, look at the Python Cookbok. See
http://aspn.activestate.com/ASPN/Python/Cookbook/

Other relevant sources for information for a newbie are...
http://mail.python.org/mailman/listinfo/tutor
http://www.freenetpages.co.uk/hp/alan.gauld/
http://www.uselesspython.com/
 
N

newcoder

The impression for me for python is that it can be scalable and you can
really build a full fledge application from it. In the past I used to
evangelized on certain language and think that the world is full of
philips screws that I can use my philips screwdriver to screw at. I was
totally wrong. But generally I think if you are looking at web
scripting, PHP is simple to learn and fast to execute; if you want to
automate and parse data on the fly, Perl is no doubt; and if you want
to build application and not in particular in execution speed, Python
is the way to go. I considered myself as a newbie too as I always
trying to learn a thing or two, here and there.

The way I learn to program usually I would get one of those open source
application written in whatever language I wish to learn and I would
study it from ground zero. I would try to understand the programmer
style and also try to understand his logic and why he want to do this
or that. You may think its crazy but I kinda like to pretend I am a
detective trying to solve a case. When you have the right attitude and
fun, you will pick up fast. This way you will basically learn
everything. Books are good but just don't get sucked into everything. I
discovered that in real programming life, 80% of what you apply comes
from the 20% of the knowledge you've learn. Just my n cents worth.

Pardon my political incorrect grammar if any, as I am not a native
english speaker.
 
K

Kent Johnson

Mark said:
Hi All,

I'm taking the plunge into Python. I'm currently following this tutorial,
http://docs.python.org/tut/
I am not a programmer in general, although I've learnt a bit of bash
scripting and some php/asp. I want to get into python to use it for
Linux/Unix related stuff. A question I have, is, those of you who use it
for the same things, what do you primarily use it for. Could you show me
some examples.? I find the hardest thing with programming, is not
remember the syntax/logic etc, but, when to use it. Perhaps that is also
a personal thing, but, I'd love to see some basic examples out there.

As others have said, Python is very useful for a wide range of tasks. But you asked for simple
examples. One thing I use Python for is simple file manipulations. I recently had to look through
2,400 folders to see if they contained two specific files in a nested subfolder. This is easy to do
in Python; below is my script.

Kent


''' Look in the warehouse for courses that are missing
\output\html\saveres.htm and/or \output\html\readres.htm

path module from http://www.jorendorff.com/articles/python/path/
'''

import path, sys

def checkCourses(basePath, out):
''' Iterate through the course / output / html folders rooted at basePath
looking for missing files.
'''
for coursePath in basePath.dirs():
htmlPath = coursePath / 'output' / 'html'
if not htmlPath.exists():
continue

for fileName in [ 'saveres.htm', 'readres.htm' ]:
aPath = htmlPath / fileName
if not aPath.exists():
print >>out, aPath
print >>out

basePath = path.path(r'\\Amrnasfs1\QA\BS_and_SIMS\Content')

out = open('MissingFiles.txt', 'w')
checkCourses(basePath, out)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top