Did you like how we did? Rate your experience!

Rated 4.5 out of 5 stars by our customers 561

Award-winning PDF software

review-platform review-platform review-platform review-platform review-platform

Video instructions and help with filling out and completing Where Form 8815 Filers

Instructions and Help about Where Form 8815 Filers

Hey there, how's it going everybody? In this video, we'll be learning how to work with file objects in Python and some of the useful things that we can do with these objects. So, whether you use Python for desktop or web applications, you're likely going to be interacting with files a good bit. It's definitely a good skill to have, to know how to properly interact with these file objects. Okay, so let's go ahead and dive in. To get a file object, we can use the built-in open command. So, I have a file here called test.txt in the same directory as my Python file. Now, if I open this file, we can see that it's just a plain text file with multiple lines. So, let's see how we can open and read this file from within Python. Now, the way I'm going to open up the file right now isn't the way that it's normally recommended. It's usually recommended to use a context manager, which I'll show you here in just a second. But to show you why a context manager is useful, let me first show you this method for opening files first. So, what we're going to do here is we're going to say F equals open and we're just going to open that test.txt file. Now, if you're working with files from different directories, then you're going to have to pass the path to that file into the open command. But since this file is within the same directory as my Python file, then I can just pass in the name of the file. But if you want to learn more about how paths work, then we touch on that a little bit in the tutorial I did on the OS module. Okay, so the open command here...