Created
May 21, 2012 14:50
-
-
Save jcppkkk/2762736 to your computer and use it in GitHub Desktop.
[python] Basics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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