From the course: Python Essential Libraries

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: PyFilesystem

Solution: PyFilesystem - Python Tutorial

From the course: Python Essential Libraries

Start my 1-month free trial

Solution: PyFilesystem

(upbeat music) - Okay, let's take a look at how I chose to approach this problem and what my solution looks like. And again, I want to emphasize, it's not important that your solution matches mine. So, what's important here is that there's multiple ways of solving a particular problem, and that we learn from different points of view. So, remember that the challenge is that we're trying to calculate a total value of all the bytes of text files within a given folder. So, let me go ahead and open up the challenge solution. All right, so since we're trying to calculate a total value, I start off by having a variable that will hold the total size of all the bytes and initialize that to zero. Then, I use pi file system to create a local file system in my current directory, because that's where the file examples folder is. And, since I need process all the files in the directory, I'm going to use a walker with the info method…

Contents