file.read()
reads entire file's contents, unless you specify max length. What you must be meaning is .readlines()
. But you can go even more idiomatic with a list comprehension:
with open('drugs') as temp_file:
drugs = [line.rstrip('\n') for line in temp_file]
The with
statement will take care of closing the file.