import os import requests # Define the path where the input file will be saved input_file_path = 'input.txt' # Check if the file already exists. If not, download it. if not os.path.exists(input_file_path): data_url = 'https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt' with open(input_file_path, 'w') as f: f.write(requests.get(data_url).text)