Type the following in the python interpreter:

help()
modules
[name of module]

You should see a list of the methods in the module with their descriptions.

Original: craschworks - comments

Suppose you’re executing a python script in the debugger, and you want to find out where the script you’re executing is located. This should do the trick:

import os
os.path.dirname( os.path.realpath( __file__ ) )

Original: craschworks - comments

It currently doesn’t take any options, though I plan to modify it to read from a filename in addition to stdin. Also, I should modify it to use imagemagick to get the image width and height values, since I don’t think there’s a guarantee that the metadata will store the image dimensions.

Read the rest of this entry » )

Original: craschworks - comments

Suppose you want to write a Python program that solicits input from a the user, but goes ahead anyway with a default value if they don't respond in say, 5 seconds. The following snippet of code implements such a thing:

Read more... )

Syndicate

RSS Atom