Back
Use this code as a reference to your question:
with open(fname) as f: content = f.readlines()# if you don't want whitespace characters like `\n` at the end of each linecontent = [q.strip() for q in content]
You can ask your doubts in comments down below, Happy Learning...!!
31k questions
32.8k answers
501 comments
693 users