Skip to content

Instantly share code, notes, and snippets.

@jcppkkk jcppkkk/gist:2762736
Created May 21, 2012

Embed
What would you like to do?
[python] Basics
## Dict Database for col_fam.batch_insert()
a={}
for r in range(3):
row_key='raw{}'.format(r)
a[row_key]={}
for i in range (5):
a[row_key]['name{}'.format(i)]='val{}'.format(i)
print a
##{'raw2': {'name4': 'val4', 'name2': 'val2', 'name3': 'val3', 'name0': 'val0', 'name1': 'val1'},
## 'raw0': {'name4': 'val4', 'name2': 'val2', 'name3': 'val3', 'name0': 'val0', 'name1': 'val1'},
## 'raw1': {'name4': 'val4', 'name2': 'val2', 'name3': 'val3', 'name0': 'val0', 'name1': 'val1'}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.