forked from MorvanZhou/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mofan Zhou
committed
Jun 17, 2016
1 parent
c24aa52
commit 2c22923
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# View more python learning tutorial on my Youtube and Youku channel!!! | ||
|
||
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg | ||
# Youku video tutorial: http://i.youku.com/pythontutorial | ||
|
||
import pickle | ||
|
||
a_dict = {'da': 111, 2: [23,1,4], '23': {1:2,'d':'sad'}} | ||
|
||
# pickle a variable to a file | ||
file = open('pickle_example.pickle', 'wb') | ||
pickle.dump(a_dict, file) | ||
file.close() | ||
|
||
# reload a file to a variable | ||
with open('pickle_example.pickle', 'rb') as file: | ||
a_dict1 =pickle.load(file) | ||
|
||
print(a_dict1) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|