课程: Python Essential Libraries
今天就学习课程吧!
今天就开通帐号,24,100 门业界名师课程任您挑!
Challenge: PyFilesystem
(upbeat music) - [Instructor] Okay, it's time for another programming challenge. So let's take what we learned in this chapter about working with Py File system and put it to use. So here's the challenge. How would use this library to calculate the total size of all the text files contained within a given directory including all of the subdirectories? So if you look at the file examples folder, you'll notice that there are a few different file types within here. So we have some text files, right, we've got some RTF files. There's a couple of Word docs in here. So what I'm going to do is run the finished version of the challenge to show you what the output should look like. So let me go over to my terminal and I'm going to go ahead and run this. And you can see that when I run this, the result there is that all of the text files take up 1,476 bytes of space. So, take a few moments, think about how you might solve this…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。