Appending To A Nested List

2002-04-15 Thread John Abel
I apologise if this seems a simple question, but I've checked through the online docs, and scoured all the sources I know. I'm trying to append items to a nested list. At first I tried: for CFGSection in hConfig.sections(): for CFGOption in hConfig.options(CFGSection):

Re: Appending To A Nested List

2002-04-15 Thread Patricia J. Hawkins
I'm not sure if your list is an existing list, or if you're building it as you go. For an existing list, here's how to append to a nested item that's a list -- first, not in a loop, and then in a loop: >>> list = [[12,3,4], [5,2,6],[2,3,4]] >>> list[1].append(99) >>> list [[12, 3, 4], [5, 2, 6,

Re: Appending To A Nested List

2002-04-15 Thread Reggie Dugard
I'm not quite sure what you mean by nested list here since it looks like you're using dictionaries. I'm going to assume that 'SettingStore' is a dictionary with the keys being sections and the values being dictionaries of options for each section. If this is the case, your code would look someth

Re: Appending To A Nested List

2002-04-15 Thread Reggie Dugard
I was a little too fast on the send key with that last letter and I omitted a line. Here's what I should've sent: SettingStore = {} for CFGSection in hConfig.sections(): SettingStore[CFGSection] = {} for CFGOption in hConfig.options(CFGSection): Sett

Serial Port Communication

2002-04-15 Thread Srividya Visweswarababu
Hi, I am using the pySerial module to talk to one of the devices connected to my RS232 port. When i issue some command through that module: >>> ser.write("#50 MDMODE") >>> ser.inWaiting() 4L >>> ser.read(4) '\x12\xb4\xfc\t' ->It seems like I am getting the output in hex format. Is there a way t

RE: Serial Port Communication

2002-04-15 Thread Michael Robin
You are most likey getting the result in binary - the python interpreter is just being nice and showing you the results so you can read them. try these lines: >>>s = ser.read(4) >>>print len(s) >>>print [ord(b) for b in s] mike -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAI