dictionary

Terry Reedy tjreedy at udel.edu
Fri Oct 24 12:18:41 EDT 2008


asit wrote:
> what the wrong with the following code ????
> 
>>>> d={"server":"mpilgrim","database":"master",
> ... "uid":"sa",
> ... "pwd":"secret"}
> 
>>>> d
> {'pwd': 'secret', 'database': 'master', 'uid': 'sa', 'server':
> 'mpilgrim'}
> 
>>>> ["%s="%s" % (k,v) for k,v in d.items()]
>   File "<stdin>", line 1
>     ["%s="%s" % (k,v) for k,v in d.items()]
>                                           ^
> SyntaxError: EOL while scanning single-quoted string

By single-quoted, the message mean quoted by ' or " rather than 
triple-quoted with ''' or """.




More information about the Python-list mailing list