#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Location
    United Kingdom
    Posts
    3
    Rep Power
    0

    Running some code


    Hi,

    I'm an absolute beginner, I'm afraid. Scanned the forum for an answer and couldn't find one... so I guess I have to stick my neck out.

    I've got hold of some code and wish to run it. I've managed to load and active the Python27 and i'm at the stage where the Command Prompt dialogue box is at >>>

    I've done some playing with typing some basics and the pressing enter. But pressing enter after pasting in this code doesn't work.

    I know it's basic... but I'm struggling to find anything online.

    Any help would be much appreciate.


    (p.s. I've ordered a book for beginners, it's just that will take a few days to arrive)
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481
    Here's the official python tutorial: http://docs.python.org/tutorial/index.html

    Explicit instructions for what you should type next depend on the effect you want and what's in the file.

    On the command line

    $ python superduperprogram.py


    might work.


    Or, maybe importing the module is better.


    $ python
    Python Version blah blah blah
    >>> import superduperprogram
    >>> superduperprogram.go(x=46)
    'You win!'
    >>>

    Comments on this post

    • cheekychives agrees : A quick response and very helpful!
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Location
    United Kingdom
    Posts
    3
    Rep Power
    0
    That's much appreciated. Ill read through this today. Thanks.
  6. #4
  7. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481
    Hmm, so many people so much sharper than I am. I was already a programmer and spent a full week working through the python tutorial while on vacation at my quasi-daughter-in-laws home in Texas.
    [code]Code tags[/code] are essential for python code and Makefiles!
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    139
    Rep Power
    4
    Originally Posted by b49P23TIvg
    Hmm, so many people so much sharper than I am. I was already a programmer and spent a full week working through the python tutorial while on vacation at my quasi-daughter-in-laws home in Texas.




    HAHAHA!!
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Location
    United Kingdom
    Posts
    3
    Rep Power
    0
    Originally Posted by b49P23TIvg
    Hmm, so many people so much sharper than I am. I was already a programmer and spent a full week working through the python tutorial while on vacation at my quasi-daughter-in-laws home in Texas.
    Err... umm, I see what you mean. I may have been a tad optimistic by saying I'll read it in a day... lol
  12. #7
  13. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2005
    Posts
    620
    Rep Power
    65
    You would be much better off to paste the code into the editor of an IDE (Integrated Development Environment) like IDLE and run (press F5 key) it from there.

    You can find IDLE for instance in:
    C:\Python27\Lib\idlelib\idle.py

    Comments on this post

    • cheekychives agrees : Very helpful.
    Last edited by Dietrich; June 27th, 2012 at 10:35 AM.
    Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25

IMN logo majestic logo threadwatch logo seochat tools logo