Re: [Tutor] Problem formatting raw_input

2008-10-31 Thread Kent Johnson
On Thu, Oct 30, 2008 at 11:03 PM, Peter Anderson [EMAIL PROTECTED] wrote: My problem is with the actual entry of the ASCII codes. My solution has a if test to remove the leading 0 from an input of say 033. With this test the output of the decode is correct in printing !. Without the if test

[Tutor] python editor / IDE

2008-10-31 Thread spir
Hello, I have read tons of reviews of editors for python. But they seem to be all biased, meaning that what the author finds important is well documented while the rest not at all. I'm looking for something like a simple table showing main features for all editors or IDEs. Do you know of

Re: [Tutor] Setting up server for CGI

2008-10-31 Thread Kent Johnson
On Thu, Oct 30, 2008 at 11:18 PM, [EMAIL PROTECTED] wrote: I'm not sure what you mean, What directory do you run from?. I mean, what is the working directory when you run your cgihttpserver.py program. You should be in the parent directory of the cgi directory so the server can find the cgi

Re: [Tutor] python editor / IDE

2008-10-31 Thread W W
Denis, You'll find that most editing is subjective - people use what they're comfortable with. My recommendation to you, since you love notepad++ and are obviously comfortable with it; set it as your default editor and install IPython, then use the %ed magic function to work on your code; or have

Re: [Tutor] csv manipulation

2008-10-31 Thread Serdar Tumgoren
Hey everyone, I spent a day trying to adapt Mr. Gailer's simple and elegant code to the csv version suggested by Mr. Johnson, but I can't seem to get it working. I adapted the example to my particular use case, but the problem occurs regardless of the dataset used: Namely, when I loop through

Re: [Tutor] csv manipulation

2008-10-31 Thread Serdar Tumgoren
sorry -- forgot to complete my thought in 2nd graf. see below... On Fri, Oct 31, 2008 at 9:29 AM, Serdar Tumgoren [EMAIL PROTECTED]wrote: Hey everyone, I spent a day trying to adapt Mr. Gailer's simple and elegant code to the csv version suggested by Mr. Johnson, but I can't seem to get it

Re: [Tutor] fast list traversal

2008-10-31 Thread Kent Johnson
On Fri, Oct 31, 2008 at 8:34 AM, Dinesh B Vadhia [EMAIL PROTECTED] wrote: Hi Kent The code is very simple: dict_long_lists = defaultdict(list) for long_list in dict_long_lists.itervalues() for element in long_list: array_a[element] = m + n + p# m,n,p are

Re: [Tutor] csv manipulation

2008-10-31 Thread Kent Johnson
On Fri, Oct 31, 2008 at 9:32 AM, Serdar Tumgoren [EMAIL PROTECTED] wrote: Below is my code. Can someone tell me how I'm botching the use of the writerows method? Also, on a separate note, is it possible and necessary to close the input and output files when using csv module? I keep getting a

Re: [Tutor] csv manipulation

2008-10-31 Thread Serdar Tumgoren
Aha! That did the trick. Thanks so much! On Fri, Oct 31, 2008 at 10:02 AM, Kent Johnson [EMAIL PROTECTED] wrote: On Fri, Oct 31, 2008 at 9:32 AM, Serdar Tumgoren [EMAIL PROTECTED] wrote: Below is my code. Can someone tell me how I'm botching the use of the writerows method? Also, on a

Re: [Tutor] Problem formatting raw_input

2008-10-31 Thread bob gailer
Peter Anderson wrote: Dj Gilcrease wrote: The simple answer is to just use chr(int(inNum)) though here is how I would do it def convert_string_to_int(strInt): try: return int(strInt) except ValueError: return 0 def getNumbers(output): inNum = raw_input(Please

[Tutor] how to call a binding method from an imported module

2008-10-31 Thread dwbarne
This problem involves a callback method while using 'bind'. The bind statement and the callback function are both in a module imported to the main program. Relevant code snippets are as follows: # begin snippet # main code code import module_Editor . class MyClass(): code def

Re: [Tutor] how to call a binding method from an imported module

2008-10-31 Thread Kent Johnson
On Fri, Oct 31, 2008 at 4:16 PM, [EMAIL PROTECTED] wrote: This problem involves a callback method while using 'bind'. The bind statement and the callback function are both in a module imported to the main program. Relevant code snippets are as follows: # begin snippet # main code

[Tutor] mergin two csv files based on a common join

2008-10-31 Thread [EMAIL PROTECTED]
Hello again, Thanks for the replies on my previous post, but I have a different problem now and don't see how to deal with it in a smooth way. I have two csv files where: 1.csv 1, text, aa 2, text2, something else 3, text3, something else 2.csv text, xx text, yy text3, zz now I would like

Re: [Tutor] mergin two csv files based on a common join

2008-10-31 Thread Kent Johnson
On Fri, Oct 31, 2008 at 6:04 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello again, Thanks for the replies on my previous post, but I have a different problem now and don't see how to deal with it in a smooth way. I have two csv files where: 1.csv 1, text, aa 2, text2, something

Re: [Tutor] mergin two csv files based on a common join

2008-10-31 Thread W W
On Fri, Oct 31, 2008 at 4:04 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello again, Thanks for the replies on my previous post, but I have a different problem now and don't see how to deal with it in a smooth way. I'd probably use a dict with a list as the value: snip 1, text, aa

Re: [Tutor] Problem formatting raw_input

2008-10-31 Thread Rich Lovely
The try: except: clauses allow for someone typing something like 'spam' when the program expects a number. It stops the program dying with an error message. --- Richard Roadie Rich Lovely Part of the JNP|UK Famille www.theJNP.com --- (Sent from my iPod - please allow for any typos: it's a

Re: [Tutor] how to call a binding method from an imported module

2008-10-31 Thread Rich Lovely
Is TempDef defined within a class block? All functions defined within a class take self as the first (or only) argument. That appears to be the usual cause of that error... Otherwise, you can say def tempDef(*args): #stuff Or just def tempDef(args): #stuff Seeing as it only receives