课程: Level Up: Python
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Save a dictionary
(gaming music) - Python dictionaries are incredibly useful for storing and retrieving information, but that data is held in memory. So when the program exits, it disappears. But what if you need that dictionary again later? Your goal for this challenge is to write a function to save a Python dictionary object to file. Your safe function should take two input arguments for the dictionary to save, and an output file path. Now, saved data's only useful if you can retrieve it later, so you should also write a second function to load the saved dictionary back into Python. That load function should take a file path to the saved dictionary as its input, and then return the retrieved dictionary object. Pause the video now to create your own solution. Then I'll show you how I solve this challenge. When you need to preserve something for later, you pickle it. So that's what I did for my solution. In Python, pickling…
内容
-
-
-
Find prime factors3 分钟 11 秒
-
(已锁定)
Identify a palindrome2 分钟 48 秒
-
(已锁定)
Sort a string3 分钟 2 秒
-
(已锁定)
Find all list items3 分钟 12 秒
-
(已锁定)
Play the waiting game2 分钟 22 秒
-
(已锁定)
Save a dictionary3 分钟 13 秒
-
(已锁定)
Schedule a function3 分钟 16 秒
-
(已锁定)
Send an email3 分钟 12 秒
-
(已锁定)
Simulate dice3 分钟 16 秒
-
(已锁定)
Count unique words3 分钟 12 秒
-
(已锁定)
Generate a password3 分钟 59 秒
-
(已锁定)
Merge CSV files3 分钟 35 秒
-
(已锁定)
Solve a sudoku4 分钟 8 秒
-
(已锁定)
Build a zip archive3 分钟 42 秒
-
(已锁定)
Download sequential files4 分钟 2 秒
-