Python 官网下载
登录官方网站下载python 解释器。
https://www.python.org/downloads/
页面截图
《python 文件Docx 操作》,https://python-docx.readthedocs.io/en/latest/index.html
该文件中有python操作的各个说明。
python解释器(interpreter)安装
Python 程序可以在任何安装了 Python 解释器的计算机环境中执行,因此,可以不经修改地实现跨操作系统运行。→平台无关。
嵩天:《全国计算机等级考试二级教程 Python语言程序设计》,教育部考试中心编,北京:高等教育出版社,2022年,第11页。
python 解释器有两个重要工具。
IDLE (integrated development environment) : Python 集成开发环境,编写和调试 Python 代码
pip : Python 第三方库安装工具, 用来在计算机上安装第三方库。
python中的pip用法
Python安装后,需要用pip安装相应的包。下面是pip的相关用法。
Usage:
pip3 <command> [options]Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
config Manage local and global configuration.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
help Show help for commands.General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort).
--trusted-host <hostname> Mark this host as trusted, even though it does not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.
--no-color Suppress colored output
说明:pip常用的子命令有:install、download、uninstall、freeze、list、show、search、wheel、hash、completion、help。
注意:get并不是pip的工具命令,hash才是pip的工具命令。
一日一图
代码如下:
import turtle
n = 100
turtle.tracer(False)
for j in range(n):
turtle. pendown()
for i in range(10):
turtle.fd(4)
turtle.right(10)
turtle.penup()
turtle.fd(4*j)
turtle.done()
生成效果图如下:
继续运行,最终如下效果。
即可完成。