Trying to lead list from txt file in a library system
class Library: def __init__(self,listofbooks): #what attributes does a library in general have? - for now, let's abstract and just say it has availablebooks (we're not going to program the shelves, and walls in!) self.availablebooks=listofbooks def displayAvailablebooks(self): print("Here are the books in our library:") print("_________________________________") for book in self.availablebooks: print(book) def lendBook(self,requestedBook): if requestedBook in self.availablebooks: print("you have successfully borrowed the book") self.availablebooks.remove(requestedBook) else: print("Sorry the book you have requested is currently not in the library") def addBook(self,returnedBook): self.availablebooks.append(returnedBook) print("You have successfully returned the book. Thank You!") class Student: def requestBook(self): print("Enter the name of the book you would like to lend ") self.book=input() return self.book def returnBook(self): print("Enter the name of the book you would like to return ") self.book=input() return self.book def main(): f = open("books.txt", "w") for sublist in books: sublist = str(sublist) f.write(str(sublist[1:-1])) f.write("\n") f.close() library=Library() student=Student() done=False while done==False: print(""" ======WELCOME TO THE LIBRARY MENU======= Please Select One of the Four Options :) 1. Display all available books 2. Request a book 3. Return a book 4. Exit =========