Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

python question?


pnksk8er2007's Avatar
Member
0 0

ok so i know to write python code you have to do it in MS-DOS(command prompt) and it exeutes right away like (i.e. print "hi" hi) how do you write like a program that you dont wanna execute until you say so? and how do you save python projects? you have to write it in a text editor?


richohealey's Avatar
Python Ninja
0 0

What the hell are you on?!

Download the Python IDE, called IDLE.

That ought to sought out most of your problems.


ghost's Avatar
0 0

heh I'm not the only hacker/skater on here.

alternatively, on linux you can save your script in a text file and execute the text file, I think you can do the same with windows though.

tip: "sk8r" was cool when we were all 12. and "punk" isn't much of a compliment in the hacking world either. I'd get a new alias really fast before you get too many points because you can't change your acc name. unfortunately I've forgotten how to do half the challenges so I don't feel like starting over…just some advice.


ghost's Avatar
0 0

i think you are talking batch not python.

language mix up maybe?


ghost's Avatar
0 0

who me?

well it basically is a batch file, you run the python interpreter:

markup#! /usr/bin/env python

then put in whatever you want it to execute:

print string```

then save it as *.py and run it by typing ./[filename] in a terminal. it then executes it like it does a shell script/batch file, except it ran the interpreter first so everything is inputted into the interpreter.


richohealey's Avatar
Python Ninja
0 0

xtrmsk8r91 wrote: then save it as *.py and run it by typing ./[filename] in a terminal. it then executes it like it does a shell script/batch file, except it ran the interpreter first so everything is inputted into the interpreter.

you don't need to save it as py.


ghost's Avatar
0 0

right, but just for organization I like to name python scripts as .py. really it's just a text file though so it doesn't matter.


ghost's Avatar
0 0

pnksk8er2007 wrote: ok so i know to write python code you have to do it in MS-DOS(command prompt) and it exeutes right away like (i.e. print "hi" hi) how do you write like a program that you dont wanna execute until you say so? and how do you save python projects? you have to write it in a text editor?

http://www.python.org/ftp/python/2.5.1/python-2.5.1.msi

Python is a pretty fun language, good for getting a feel of how to solve problems by coding.

http://www.python.org/doc/