I am following https://automatetheboringstuff.com/2e/chapter8 CHAPTER 8. Input validation. In terminal, do pip3 install --user pyinputplus . Then in Python, do import pyinputplus as pyip inputStr() is like input(). x = pyip.inputNum() inputNum() ensures the user enters a number and returns an int or float, depending on if the number has a decimal point in it inputChoice() Ensures the user enters one of the provided choices inputMenu() Is similar to inputChoice(), but provides a menu with numbered or lettered options. inputDatetime() Ensures the user enters a date and time. inputYesNo() Ensures the user enters a “yes” or “no” response. inputBool() Is similar to inputYesNo(), but takes a “True” or “False” response and returns a Boolean value. inputEmail() Ensures the user enters a valid email address. x = pyip.inputEmail() inputFilepath() Ensures the user enters a valid file path and filename, and can optionally check that a file with that name exists. inputPassword() is like the built-in input(), but displays * characters as the user types so that passwords, or other sensitive information, aren’t displayed on the screen. This works in terminal but not in IDLE. limit = 2 means they only get 2 tries and timeout=10 means they only get 10 seconds! Cool. response = pyip.inputNum(timeout=10,default="NA") ## It still waits til you answer though. CHAPTER 9. Reading and writing files. The beginning of chapter 9 covers paths. This seems unnecessary to me. As we saw before, you can use import os os.getcwd() os.chdir("/Users/rickpaikschoenberg/Desktop/Python") os.path.getsize("pig.py") ## says how big the file is. Cool. os.listdir() ## lists files. for filename in os.listdir(): print(filename + " " + str(os.path.getsize(filename))) You can use glob() to list only certain files. ## Writing to files. from pathlib import Path p = Path("new.txt") p.write_text("test it out now") p.read_text() ## Better to use open() newfile = open("new.txt") newfile.read() newfile.readlines() ## One string for each new line. newfile = open("new.txt","a") ## a for append mode. w for write mode for overwriting the file. newfile.write("\nthis is the 2nd line.\n") newfile.close() newfile = open("new.txt") print(newfile.readlines()) newfile.close() ## Save variables with pprint(). import pprint cats = [{'name': 'Zophie', 'desc': 'chubby'}, {'name': 'Pooka', 'desc': 'fluffy'}] fileObj = open('myCats.py', 'w') fileObj.write('cats = ' + pprint.pformat(cats) + '\n') fileObj.close()