Invalid Syntax When Creating Python Dictionary -


this part of project class on python scripting in arcgis.

i have created dictionary in python script according data structure. here code have written.

id = {     'name': {         'first',          'middle',          'last'     },     'age': { '22' },     'oit': {         'title',         'address': ['strnum','street'],         'email',         'phone': ['area code', 'exchange', 'number']     },     'home': {         'title',         'address': ['strnum', 'street'],         'email',         'phone': ['area code', 'exchange', 'number']     } } 

when run code says "failed run script - syntax error - invalid syntax". doens't tell me , can't seem find it. , won't let me debug either throws same error. syntax error?

your dictionary riddled syntax errors. example, name sub-dictionary:

'name': {         'first',          'middle',          'last'     }, 

needs be

'name': {         'first': some_value,         'middle': another_value,          'last': and_another     }, 

more likely, however, want these keys simple list instead. note use of square brackets instead of curly braces:

'name': [         'first',          'middle',          'last'     ], 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -