课程: Python Essential Libraries

今天就学习课程吧!

今天就开通帐号,24,100 门业界名师课程任您挑!

Solution: Pillow

Solution: Pillow

(upbeat music) - [Instructor] All right, let's take a look at my solution to this particular challenge and see how it compares to yours. And remember, it's not important that your solution be the same as mine. There are almost always multiple ways to solve a programming problem. So let's go ahead and open up the challengesolution.py file. And you can see it's not very many lines of code. And that's because the Pillow library has a lot of great features in it. So here's what we're going to do. Now, the top of the file, obviously I need to import the Image class from the Pillow library. Pretty sure you got that. And I'm also going to make use of two of the standard library modules, the os module for working with file and path names and the glob module for building a list of files from a directory. All right, so my code to find a variable named thumbsize to be a tuple of 128 by 128. So this is the size that we're going to…

内容