Inconsistency with split() - Script, OS, or Package Problem?
Ian Kelly
ian.g.kelly at gmail.com
Mon May 9 15:51:01 EDT 2011
On Mon, May 9, 2011 at 1:29 PM, James Wright <jamfwright at gmail.com> wrote:
> It does not appear to show a key:
>
> D4[] = vsr
> Traceback (most recent call last):
> File "render4.py", line 115, in <module>
> create_report_index(each_item)
> File "render4.py", line 26, in create_report_index
> [clean_name, _] = each_value.split('_', 1)
> ValueError: need more than 1 value to unpack
The key appears to be the empty string. You can confirm that by
changing the %s to %r in Ethan's diagnostic. That will print out the
repr() of the value, which should make it more clear what the value
actually is.
More information about the Python-list
mailing list