Debian 5
python 2.5.2, or 2.6.2
I use either NetBeansEA-6.7.1, or GVIM-7.1.314, or Komodo Edit-5.2. Just depends on what mood I'm in.
User Profile
Collapse
-
Windows Vista or Debian Stable
Python 2.5.2
Notepad++ or PsPad (Windows), or Vim (Linux)
IDLE (Windows & Linux)Leave a comment:
-
Sorry, I haven't crossed that bridge yet. Try asking on the python tutor mailing list.
http://mail.python.org/mailman/listinfo/tutor...Leave a comment:
-
to open a file for reading:
Code:file = open("c:\path\to\file.txt", 'r') # Windows file = open("/home/user/file.txt", 'r') # for Linux for line in file: print line, file.close()
This will print out each line of "file".Leave a comment:
-
I have been dealing with the same issue. I'm also a python noob, but a couple of things comes to mind: remember, Windows uses a backward slash, '\', and linux uses a forward slash, '/'.
Also, to have your python script use the current path, use:
path will be the current path.Code:import sys path = sys.path[0]
Leave a comment:
-
What are you trying to do with this? I think os.popen is for executing programs, not for opening text files....Leave a comment:
-
Use the sys module
The way I have done this is to use the sys module, like so:
The current path will be printed out.Code:import sys path = sys.path[0] print path
Leave a comment:
-
-
Okay, here's the complete code. I didn't cut-and-paste, I typed this out, straight from the web site. My point is, I don't think the "continue" statement belongs in an "if" block. Am I right, or not? Because everytime I run the program I get a 'continue' not properly in loop" error.
...Code:def animal(): # start with a singleton root = Tree("bird") # loop untilLeave a comment:
-
continue problem
Hi folks,
I'm working my way through "How to Think Like a Computer Scientist Learning with Python" from this link:
https://www.greenteapress.com/thinkp...ml/chap20.html.
In 'The animal tree" program I keep getting a " 'continue' not properly in loop" error. It's coming from the "make a guess" section of the code:
...Code:# make a guess guess = tree.getCargo() -
Which OS are you on? If it's a *nix, that's easy using cron. See man cron.Leave a comment:
No activity results to display
Show More
Leave a comment: