To get a look at file handling in action, we're going to replace the
prepLoadGroup method of our
Preloader class with a file loading operation.
PreloaderClass_01.py. Scroll down to the
prepLoadGroupmethod and copy this line with Ctrl+C:
self.totalItems = len(self.models)
__init__method and find the line where we call
self.prepLoadGroup. Highlight that line and hit Ctrl+V to paste the line we copied over it, replacing it.
file = open("models.txt", "r") self.models = file.readlines() file.close() for N in range(len(self.models)): self.models[N] = self.models[N].replace("\n", ...