Newbie Here

Discussion in 'Python' started by Mark Sargent, May 31, 2005.

  1. Mark Sargent

    Mark Sargent Guest

    Hi All,

    I'm taking the plunge into Python. I'm currently following this tutorial,
    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.

    Mark Sargent.
    Mark Sargent, May 31, 2005
    1. Advertisements

  2. Mark Sargent

    Peter Maas Guest

    - little daily stuff e.g. transforming data
    - sysadmin tasks (backup scripts)
    - web applications (replacing asp/php)
    Peter Maas, May 31, 2005
    1. Advertisements

  3. 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.
    raviteja.bhupatiraju, May 31, 2005
  4. Mark Sargent

    Rob Cowie Guest

    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 for a load of tutorials
    and examples
    Rob Cowie, May 31, 2005
  5. Mark Sargent

    Peter Maas Guest

    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. ;)
    Peter Maas, May 31, 2005
  6. Mark Sargent

    Magnus Lycka Guest

    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
    For coding examples, look at the Python Cookbok. See

    Other relevant sources for information for a newbie are...
    Magnus Lycka, May 31, 2005
  7. Mark Sargent

    newcoder Guest

    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.
    newcoder, May 31, 2005
  8. Mark Sargent

    Kent Johnson Guest

    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.


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

    path module from

    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():

    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)
    Kent Johnson, Jun 1, 2005
  9. Mark Sargent

    Dave Cook Guest

    Dave Cook, Jun 2, 2005
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.