TypeError: iterable argument required

Νικόλαος Κούρας nikos.kouras at gmail.com
Wed Apr 6 11:41:24 EDT 2011

On 6 Απρ, 16:54, "eryksun ()" <eryk... at gmail.com> wrote:

> You can also use an empty string as the default value when getting the field value

Please provide me an example.

> Also, a simple OR statement can eliminate the None. For example: mail = mail or ''. Since None is False, the statement returns the right-hand operand, which is an empty string ''.

>>> mail = None
>>> mail
>>> mail = mail or ''
>>> mail

Why in 2nd case the returned value of mail is None. Why shouldn't it
be the empty string since mail = None which is false.

How exactly Python parses those two statements in english words?

>>> mail = None
>>> mail
>>> mail = '' or mail
>>> mail

> The line I wrote not only didn't properly quote or escape the data values, but it probably also broke the protection from a SQL injection attack. Always list the data in the 2nd parameter as a tuple.

Can you please also provide an example of what happens if i use the
special formatting identidier `%` instead of a comma?

More information about the Python-list mailing list