Re: problem with appending to a list, possibly mysqldb related



John Salerno wrote:
John Purser wrote:

I'd say you had a record with a null value for the namefirst field.
The join method don't like that.

Wow, you're right! I tried this:

if x[0] and not x[0] == 'NULL':

and sure enough it works after that. (Not sure if that's the best way to test, though. Just testing for NULL still produced the error, so I guessed that some namefirst fields were actually blank.)

Just tried again with:

if x[0]:

and that worked, so I guess NULL isn't a string value.
.



Relevant Pages

  • Re: how exactly do binary files work in python?
    ... John Salerno wrote: ... You can use the struct module for converting fundamental types to a portable string representation for writing to binary files. ... Since you're dealing with a high-level language, you can also just use the pickle module for a more general form of serialization and persistence. ...
    (comp.lang.python)
  • Re: Join strings - very simple Q.
    ... The sequence is passed as an argument to the join method, ... delimiter is the string whose method is being called. ...
    (comp.lang.python)
  • Re: Operators as functions
    ... but as other have already pointed out, turning a list of strings into a single ... in pre-unicode python style (note that in the first case, ... your code will copy string 1 and 2 to a new string (let's call it ... the join method, in contrast, does it all in one operation. ...
    (comp.lang.python)
  • Re: [MSH] Applying regular expression to whole file
    ... another way to achieve this is using the join method on the string object ... > out-string cmdlet takes it's input and returns the result as a single ...
    (microsoft.public.windows.server.scripting)
  • RE: int to string
    ... The + operator returns a string. ... "John Salerno" wrote: ... > int i = 0; ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)