I am trying to add lines from a txt file to a python list for iteration, and the script wants to print every line and return an error. I'm using the readlines() function, but when I use list.remove(lines), it returns an error: File "quotes.py", line 20, in main list.remove(lines) TypeError: remove() takes exactly one argument (0 given).
def main():
while True:
try:
text_file = open("childrens-catechism.txt", "r")
lines = text_file.readlines()
# print lines
# print len(lines)
if len(lines) > 0:
print lines
list.remove(lines)
time.sleep(60)
else:
print "No more lines!"
break
text_file.close()
I can't see what I'm doing wrong. I know it has to do with list.remove(). Thank you in advance.