File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 pip install -r requirements.txt
1616 ```
1717
18- - [ virtualenv] ( https://www.liaoxuefeng.com/wiki/1016959663602400/1019273143120480 ) 用来为一个应用创建一套“隔离”的 Python 运行环境。
18+ - [ Python 环境管理] ( ./Python版本管理.md )
19+
20+ ``` shell
21+ # 创建环境
22+ conda create --name py310 python=3.10
23+ # 安装好后,使用activate激活某个环境
24+ activate py310
25+ # 返回主环境
26+ deactivate py310
27+ # 查看环境
28+ conda info -e
29+ # 删除环境
30+ conda remove --name py310 --all
31+
32+ # 对虚拟环境中安装额外的包
33+ conda install -n env_name [package] # 未激活环境
34+ conda install [package] # 如果已经激活环境
35+ ```
1936
2037#### 三方库
2138
2946- [ 《Python 高级编程(第二版)》] ( https://book.douban.com/subject/27133480/ )
3047- [ 《Python 资源大全中文版》] ( https://github.com/jobbole/awesome-python-cn )
3148- [ 《awesome-python》] ( https://awesome-python.com/ )
49+ - [ 《Conda 使用教程》] ( https://zhuanlan.zhihu.com/p/483716942 )
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ # conda install openpyxl==3.1.2
4+ from openpyxl import load_workbook
5+ from openpyxl .worksheet .datavalidation import DataValidation
6+ from openpyxl .utils .dataframe import dataframe_to_rows
7+ from openpyxl .worksheet .cell_range import CellRange
8+ import openpyxl
9+
10+ if __name__ == '__main__' :
11+ filename = "example.xlsx"
12+ workbook = openpyxl .Workbook (filename )
13+ # # 创建sheet1
14+ sheet = workbook .create_sheet ('sheet1' )
15+ workbook .save (filename )
16+
17+ workbook = openpyxl .load_workbook (filename )
18+ ws = workbook .active
19+ ws .cell (row = 1 , column = 1 ).value = "高"
20+ # 创建数据验证对象
21+ dv = DataValidation (
22+ type = "list" ,
23+ formula1 = '"高,中,低"' , # 这里是你要提供的选项,用逗号分隔
24+ showDropDown = True ,
25+ allow_blank = True ,
26+ )
27+
28+ # https://openpyxl.readthedocs.io/en/3.1.2/validation.html
29+
30+ ws .add_data_validation (dv )
31+ dv .add (ws ["A1" ])
32+ workbook .save ("example.xlsx" )
You can’t perform that action at this time.
0 commit comments