Difference between revisions of "Python"

From vret
Jump to: navigation, search
(Problems)
 
Line 13: Line 13:
 
=== =+ VS += ===
 
=== =+ VS += ===
 
counter += 1 isn't equal to counter =+ 1 both scripts will run with out a error but one will add 1 to the counter and the other will set the counter too 1. I haven't got counter++ working.
 
counter += 1 isn't equal to counter =+ 1 both scripts will run with out a error but one will add 1 to the counter and the other will set the counter too 1. I haven't got counter++ working.
 +
 +
=== Relative image paths ===
 +
Every python script has its own __file__ variable that gives you the path of that script file instead of the path of the running script file.
 +
:example:
 +
:os.path.join(os.path.dirname(__file__),"SudTimeBar.png")

Latest revision as of 09:51, 19 January 2010

Download

Tutorials

Documentation practice

I propose to use epydoc to generate documentation ala javadoc. This means adding text like @param and @author to the docu field in the code.

Problems

=+ VS +=

counter += 1 isn't equal to counter =+ 1 both scripts will run with out a error but one will add 1 to the counter and the other will set the counter too 1. I haven't got counter++ working.

Relative image paths

Every python script has its own __file__ variable that gives you the path of that script file instead of the path of the running script file.

example:
os.path.join(os.path.dirname(__file__),"SudTimeBar.png")