A
A
Alan Chernov2017-11-05 20:16:46
Python
Alan Chernov, 2017-11-05 20:16:46

Why does the program display Wrong key value received: "None". Check the operation of the program and the creation of the storage file?

I solve the back on courseira I paid for the certificate but no one can clearly answer ... everything works in my terminal but when I upload it to courseira it gives an error: "An incorrect value was received for the key: "None". "
The task is this:
Your task will be to write a script , which takes keys and values ​​as arguments and outputs information from the store (in our case, from a file).
Write value by key
> storage.py --key key_name --val value
Get value by key
> storage.py --key key_name
The answer in this case will be to print the corresponding value
> value
or
> value_1, value_2
if there were several values ​​for this key. Save the metrics in the order they were added. Notice the space after the comma.
If no values ​​were found for the key, output an empty string or None.
To work with command line arguments, use the argparse module. Your task will be to read the arguments passed to your program and write the corresponding key-value pair to the store file, or output the values ​​if only a key was passed. You can store data in JSON format using the standard json module. Check adding multiple keys and different values.
The file must be created using the tempfile module.
Here is the code https://pastebin.com/tnP3srrj

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question