Created
June 13, 2016 03:08
-
-
Save guyoun/4afc49255a623111ba2229a1dcae87d9 to your computer and use it in GitHub Desktop.
OrderedDict test
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"name name\n", | |
"age 23\n", | |
"weight 100\n" | |
] | |
} | |
], | |
"source": [ | |
"from collections import OrderedDict\n", | |
"\n", | |
"ordered = OrderedDict()\n", | |
"\n", | |
"ordered['name'] = 'your name'\n", | |
"ordered['age'] = 23\n", | |
"ordered['weight'] = 100\n", | |
"\n", | |
"for k, v in ordered.iteritems():\n", | |
" print k, v" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 2", | |
"language": "python", | |
"name": "python2" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 2 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.10" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment