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,
    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.
    Mark Sargent, May 31, 2005
    #1
    1. Advertising

  2. Mark Sargent

    Peter Maas Guest

    Mark Sargent schrieb:
    > 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)

    --
    -------------------------------------------------------------------
    Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
    E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
    -------------------------------------------------------------------
    Peter Maas, May 31, 2005
    #2
    1. Advertising

  3. Mark Sargent

    Guest

    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.
    , May 31, 2005
    #3
  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 http://www.awaretek.com/tutorials.html for a load of tutorials
    and examples
    Rob Cowie, May 31, 2005
    #4
  5. Mark Sargent

    Peter Maas Guest

    Rob Cowie schrieb:
    > 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. ;)

    --
    -------------------------------------------------------------------
    Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
    E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
    -------------------------------------------------------------------
    Peter Maas, May 31, 2005
    #5
  6. Mark Sargent

    Magnus Lycka Guest

    Mark Sargent wrote:
    > 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/
    Magnus Lycka, May 31, 2005
    #6
  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.


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

    Kent Johnson Guest

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

    Dave Cook Guest

    Dave Cook, Jun 2, 2005
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George Hester

    Try over here likely more to the point here

    George Hester, Sep 30, 2004, in forum: Javascript
    Replies:
    0
    Views:
    110
    George Hester
    Sep 30, 2004
  2. FAQ server
    Replies:
    0
    Views:
    154
    FAQ server
    Aug 10, 2006
  3. FAQ server
    Replies:
    0
    Views:
    128
    FAQ server
    Oct 7, 2006
  4. FAQ server
    Replies:
    0
    Views:
    147
    FAQ server
    Dec 4, 2006
  5. FAQ server
    Replies:
    7
    Views:
    132
    Dr J R Stockton
    Feb 10, 2007
Loading...

Share This Page