Question: Open Function in Python

Aug 23, 2015 01:58 AM

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

Related Articles

637263493835297420.jpg

How to Use Zero-Width Characters to Hide Secret Messages in Text (& Even Reveal Leaks)

636455706472146367.jpg

How to Hide DDE-Based Attacks in MS Word

Comments

No Comments Exist

Be the first, drop a comment!