Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

def _extract_metadata(args): metadata = {} for metadatum in args.metadata: # unset doesn't require a val, so we have the if/else print type(metadatum) if '=' in metadatum: print "True" (key, value) = metadatum.split('=', 1) else: print "False" key = metadatum value = None

    metadata[key] = value
return metadata

I found the type of "metadatum" is <type 'list'="">, list is not hashable. Am I right?

def _extract_metadata(args):
    metadata = {}
    for metadatum in args.metadata:
        # unset doesn't require a val, so we have the if/else
        print type(metadatum)
        if '=' in metadatum:
            print "True"
            (key, value) = metadatum.split('=', 1)
        else:
            print "False"
            key = metadatum
            value = None

None
        metadata[key] = value
 return metadata

I found the type of "metadatum" is <type 'list'="">, list is not hashable. Am I right?