官术网_书友最值得收藏!

Getting started

This recipe requires the installation of two third-party modules pywin32 and pytz. All other libraries used in this script are present in Python's standard library. This recipe will primarily use two libraries, the built-in shutil and a third-party library, pywin32. The shutil library is our go-to for copying files within Python, and we can use it to preserve most of the timestamps and other file attributes. The shutil module, however, is unable to preserve the creation time of files it copies. Rather, we must rely on the Windows-specific pywin32 library to preserve it. While the pywin32 library is platform specific, it is incredibly useful to interact with the Windows operating system.


To learn more about the shutil library, visit https://docs.python.org/3/library/shutil.html.

To install pywin32, we need to access its SourceForge page at https://sourceforge.net/projects/pywin32/ and download the version that matches our Python installation. To check our Python version, we can import the sys module and call sys.version within an interpreter. Both the version and the architecture are important when selecting the correct pywin32 installer.


To learn more about the sys library, visit https://docs.python.org/3/library/sys.html.


In addition to the installation of the pywin32 library, we need to install pytz, a third-party library used to manage time zones in Python. We can install this library using the pip command:

pip install pytz==2017.2
主站蜘蛛池模板: 宁安市| 江安县| 南宁市| 临安市| 德清县| 睢宁县| 临海市| 永川市| 肥西县| 泰和县| 兴业县| 鸡泽县| 民丰县| 寿光市| 内黄县| 黑山县| 涞源县| 崇左市| 白沙| 怀来县| 麻江县| 临澧县| 连云港市| 开原市| 义乌市| 怀仁县| 连南| 锡林浩特市| 普兰店市| 望奎县| 措美县| 法库县| 彰化县| 南召县| 肥乡县| 沁水县| 通许县| 田阳县| 青铜峡市| 甘德县| 科技|