摘要:
8. subprocess subprocess 是 Python 的一个标准库模块,用于生成新的进程、连接到它们的输入/输出/错误管道,并获取它们的返回码。它是 Python 中用于执行外部命令和与子进程交互的高级接口,功能强大且灵活。 subprocess.run( args, *, stdin 阅读全文
摘要:
模块 1. random random.randint 指定一个范围随机返回这个范围内的数 random.choice 随机返回列表或元组中的一个值 randint from random import randint print(randint(1,6)) choice """使用random模块 阅读全文
摘要:
文件和异常 使用vscode时需要选中文件夹按ctrl+k,接着按ctrl+o python中异常的关系结构 BaseException │ ├── SystemExit │ ├── KeyboardInterrupt │ ├── GeneratorExit │ └── Exception │ ├─ 阅读全文
摘要:
python 基础语法 match语句 def http_error(status): match status: case 400: return "Bad request" case 404: return "Not found" case 418: return "I'm a teapot" 阅读全文
摘要:
1. 列表 1)append() 增加列表项 #!/usr/bin/python3 #_*_coding:utf-8_*_ list1=["google","zhihu","newbie"] print("更新前列表:",list1) list1.append("baidu") print("更新后 阅读全文
摘要:
1)vim插件 加入一下配置,vim编辑器中按即可测试代码运行效果,无需退出编辑器 root@jiaxing:~# vim ~/.vimrc #" Quickly Run #" nnoremap <F5> :call CompileRunGcc()<CR> func! CompileRunGcc() 阅读全文