import os
import random
import time
randFileIndex = random.randint(1, 3)
file = open(str(randFileIndex) + '.txt', 'r')
key = file.read()
print(key)
file.close()
time.sleep(2)
os.remove(str(randFileIndex) + '.txt')
with open('workfile') as f:
... read_data = f.read()