VSCode安装
在上述官网选择对应的安装包下载(Windows x
64)
运行后,按照引导安装
安装成功后,在左侧"extensions"搜索Chinese
语言包按照提示重启VSCode
在左侧"扩展"搜索python,安装python扩展
Miniconda安装及使用
务必勾选"Add Miniconda3 to my PATH environ
ment variable"
创建环境
conda create -n env_name python=3.10
进入环境
conda activate env_name
退出环境
conda deactivate
Jupyter Notebook 使用
安装
pip install jupyter
打开
jupyter notebook
python知识:Python是一种高级编程语言,具
有简洁、易读的语法,被广泛应用于各种领域,
如Web开发、数据分析、人工智能等。Python使
用缩进来表示代码块,而不是像其他语言那样使
用花括号。它支持面向对象、函数式和过程式编
程范式。Python拥有丰富的标准库,包含了很多
内置模块,方便开发者快速实现各种功能。在Py
thon中,文件操作是一项常见的任务,可以通过
内置的open()函数来打开、读取、写入文件。下
面是一些常用的文件操作◇
打开文件:
file = open("example.txt", "r")
example.txt 以只读模式
读取文件内容:
content = file.read()
关闭文件:
file.close()
写入文件:
file = open("example.txt", "w")
example.txt 以写入模式
file.write("Hello, World!")
file.close()
逐行读取文件内容:
file = open("example.txt", "r")
for line in file:
print(line)
file.close()
使用with语句自动关闭文件:
with open("example.txt", "r") as file:
content = file.read0
print(content)