Using dict comprehension to append data

Regarding pretty printing of (assuming) dictionaries hopefully eases your pain a bit, I keep this in a project library so I can call it when needed.

import pprint

mydict = {'nest0':'hi',
		'nest1':{'something':1},
		'nest2':{'nest1again':{'somethingelse':'bye'}}
		}

pp = pprint.PrettyPrinter(depth=4)
pp.pprint(mydict)

image

In my experince PyDataSets are most useful when you want access to all or almost all columns in a dictionary. So for things like

for (someCol1, someCol2, someCol3) in system.dataset.toPyDataSet(ds):
    # do something with your extracted columns
    # don't need to fetch them via col1=row['someCol1']
    # or via col1 = ds.getValueAt(row,'someCol1') if a basic dataset

it's very useful.

1 Like