+ 1

How to read values from a file using when someone inputs the key name for that specific value in Python?

I'm not sure how to do this can someone help me. I am trying to get the value back from a file using the key to print the value in the terminal.

27th Jun 2022, 8:37 PM
Edward Marais
Edward Marais - avatar
2 odpowiedzi
+ 1
Do you have an attempt, even if it's just pseudocode?
27th Jun 2022, 9:13 PM
Justice
Justice - avatar
+ 1
Hi Edward Marais Use the file open() function to open a document containing the values. You can take input with the input() function. use if else statements to tell the program what to do if said number is pressed. use the read() method for reading the content of the file. use the print() function to print to the terminal (console) Search for the functions I mentioned and you'll surely find examples for how to do this. If you get stuck provide your code bit. And we can help you when in doubt.
28th Jun 2022, 12:45 AM
Chris Coder
Chris Coder - avatar