 Hey everybody this is Brian and welcome to the 12th Python tutorial. We're just going to dive right in here today We're going to be talking about the path object. So first thing we need to do is import OS or If you want to actually do it the correct way you do from OS import path Now what's the difference between those two? If you just do import OS you can then do OS dot whatever Which in this case we OS dot path and then whatever command you want But if you specifically import path from OS you can then say path That was embarrassing path dot whatever So that's really the difference between those two. So we're just going to say fro it from OS import path And we're going to actually Get a path object here. So We're going to say print and percent as whoops Having troubles with my keyboard here. We're gonna get the current directory here now if we run this It's just going to print a little dot. Yep, the current directory is dot And if you're not familiar with the dot notation basically dot is always your current directory and dot dot is the parent directory But we want to actually expand that and figure out what that really is So let's try this print and we're going to say abs path or absolute path is sent us And let's just go So we're just going to say path absolute path and then we're just going to give it the current directory that we're in and just see What it prints out here? And we're currently in my home directory. I'm on Linux. So you see these slashes if you're in windows You'll see like C Program files or C users or wherever you're at and that's kind of the beauty of Python is it's very much cross-platform Now we're just going to get the name. So we're going to say dirt name and you see the dirt name is blank That's not good. So let's get the base name from this The base name is of course dot because that's our current directory So I just I don't want you to get thrown off if you see, you know Kerter is Returning a dot now if we actually take this And make a variable and say hey, let's actually Make a string literal here and to do that you put an R in front of it The reason why you would make a string literal is if you're like on windows and you do this like C Program files, you know yada yada yada whatever blah blah blah Each one of those slashes if it's not a string literal will be interpreted as what's called an escape character Like slash P. I don't remember what that is, but if it was like slash T that'd be a tab Slash R would be you know hard return new line The only way around that would be to double escape them where you do slash slash which you know gets kind of frustrating or You would just you know Make a string literal by putting the R in front of it. I'm on a Linux machine. So don't really have to worry about it much But I'll do it anyways And we're just going to replace Kerter with this Just so we can see the difference of what it's gonna do you see now We have a base name a dirt name and an absolute path So that's really the difference between current directory in you know when you hard code a path Sometimes Kerter is not your friend and I just wanted you to be aware of that We're gonna really quickly finish up this tutorial We're gonna do exist is dirt and his file. So let's do So I don't know if there's any gamers out there, but I bought Skyrim legendary edition for like 15 bucks on steam So I've been playing that it's a lot more than what I thought it was gonna be It's actually pretty in-depth. Hey, let's say is file and what these commands are gonna do here They're pretty self-explanatory, but I'll go over them real quick You get your absolute path. Let's actually run this. Okay, you got your your absolute path Which as you can see is that your dirt name, which is just your directory name The directory or the parent directory I should say the base name is the name of the current File or directory that you're in. Yes, it exists. That's very handy when you get into file operations You want to make sure that file exists or doesn't exist and then determine if it's a directory or a file Well, that's pretty much all for this tutorial on pretty easy one, but very important information that you should definitely understand For the source code for this and other tutorials visit my website void realms.com and we've got much more coming in the future