Question: Open Function in Python
I know how the function works in python, but this code I am doing in the guide "Learn Python The Hard Way" seems repetitive. Does my code for each time it uses the function with open in it, open it? it just seems repetitive.
You think it would maybe just keep the file opened so that way you don't have to open it that much? another way i'm thinking of how it works is when a function like write() needs to access the file, instead of opening the file like i think it is each time it just uses the filename variable inside the open function instead of using the open() function to open it each time.
The target variable has the value of: open(filename, 'w') and we pass the name of the file to filename using argv upon executing the script.
I'm new to python, here is the pastebin link: http://pastebin.com/PZLc4pF9