[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版

(yzsuai) #1

As a rule of thumb, you should try to always provide an encoding name for text content
if it might be outside the platform default, and you should rely on the default Unicode
API for file names in most cases. Again, see Python’s manuals for more on the Unicode
file name story than we have space to cover fully here, and see Learning Python, Fourth
Edition, for more on Unicode in general.


In Chapter 6, we’re going to put the tools we met in this chapter to realistic use. For
example, we’ll apply file and directory tools to implement file splitters, testing systems,
directory copies and compares, and a variety of utilities based on tree walking. We’ll
find that Python’s directory tools we met here have an enabling quality that allows us
to automate a large set of real-world tasks. First, though, Chapter 5 concludes our basic
tool survey, by exploring another system topic that tends to weave its way into a wide
variety of application domains—parallel processing in Python.


Directory Tools | 175
Free download pdf