Created
May 8, 2015 08:08
-
-
Save a2chub/1574293d405f03f47396 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
#coding:utf-8 | |
key_list = range(10) | |
val_list = range(10) | |
val_list.reverse() | |
print "正解: {0:9, 1:8 ...}" | |
def unko(keyData, valData): | |
result = {} | |
cnt = 0 | |
for now_key in key_list: | |
result[now_key] = val_list[ cnt ] | |
cnt += 1 | |
return result | |
def myMap(keyData, valData): | |
result = dict(zip(keyData, valData)) | |
return result | |
def main(): | |
print key_list | |
print val_list | |
print unko(key_list, val_list) | |
print myMap(key_list, val_list) | |
if __name__ == '__main__': | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment