Re: Odd list behavior

2009-05-14 Thread Rhodri James
On Thu, 14 May 2009 17:49:33 +0100, norseman wrote: Rhodri James wrote: On Wed, 13 May 2009 23:08:26 +0100, norseman wrote: Evan Kroske wrote: I'm working on a simple file processing utility, and I encountered a weird error. If I try to get the first element of a list I'm splitting fr

Re: Odd list behavior

2009-05-14 Thread norseman
Rhodri James wrote: On Wed, 13 May 2009 23:08:26 +0100, norseman wrote: Evan Kroske wrote: I'm working on a simple file processing utility, and I encountered a weird error. If I try to get the first element of a list I'm splitting from a string, I get an error: key = string.split()[0] Erro

Re: Odd list behavior

2009-05-13 Thread Peter Otten
Evan Kroske wrote: > I'm working on a simple file processing utility, and I encountered a > weird error. If I try to get the first element of a list I'm splitting > from a string, I get an error: > > key = string.split()[0] > Error! When string contains only whitespace string.split() returns an

Re: Odd list behavior

2009-05-13 Thread Emile van Sebille
On 5/13/2009 2:51 PM Evan Kroske said... I'm working on a simple file processing utility, and I encountered a weird error. If I try to get the first element of a list I'm splitting from a string, What value of string gives these results? Emile I get an error: key = string.split()[0] Err

Re: Odd list behavior

2009-05-13 Thread Rhodri James
On Wed, 13 May 2009 23:08:26 +0100, norseman wrote: Evan Kroske wrote: I'm working on a simple file processing utility, and I encountered a weird error. If I try to get the first element of a list I'm splitting from a string, I get an error: key = string.split()[0] Error! However, I can

Re: Odd list behavior

2009-05-13 Thread norseman
Evan Kroske wrote: I'm working on a simple file processing utility, and I encountered a weird error. If I try to get the first element of a list I'm splitting from a string, I get an error: key = string.split()[0] Error! However, I can slice the list like normal, but that gives me a one-elem

Re: Odd list behavior

2009-05-13 Thread Chris Rebert
On Wed, May 13, 2009 at 2:51 PM, Evan Kroske wrote: > I'm working on a simple file processing utility, and I encountered a weird > error. If I try to get the first element of a list I'm splitting from a > string, I get an error: > > key = string.split()[0] > Error! > > However, I can slice the lis

Odd list behavior

2009-05-13 Thread Evan Kroske
I'm working on a simple file processing utility, and I encountered a weird error. If I try to get the first element of a list I'm splitting from a string, I get an error: key = string.split()[0] Error! However, I can slice the list like normal, but that gives me a one-element-long list: key