Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-14 Thread Josh Rosen
In Python, def is an executable statement. Your function is not defined until the def statement is run by Python. If you move your function definitions earlier in the code so that your functions are defined before they're used, this code will run properly. Josh R. On Aug 14, 2008, at 4:0

Re: [Tutor] IP address parse

2008-08-09 Thread Josh Rosen
On Aug 9, 2008, at 10:46 PM, Josh Rosen wrote: There are a few different problems in your code. First off, regular expressions must be passed to re.compile() as strings. patt = re.compile(\[0-9]{1,3})\.(\[0-9]{1,3})\.(\[0-9]{1,3})\. (\[0-9]{1,3}) should read patt = re.compile(r"

[Tutor] Regular Expressions: escaping in character classes/character sets

2008-07-06 Thread Josh Rosen
I was browsing through the source code of Django when I found the following regular expression: tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]') As it turns out, this line from the message module in the Python standard library's email module. It seems to be used to determine if an ema

Re: [Tutor] Script Name/Path Information

2008-07-05 Thread Josh Rosen
How about the following: import os print os.path.abspath(__file__) # the full absolute path to the current module's file print os.path.split(os.path.abspath(__file__)) # if you need the individual components of the path. On Jul 5, 2008, at 11:00 AM, Monika Jisswel wrote: import sys