- 简介
- 目录大纲
- 最新文档
Python办公自动化之word
1、Python-docx 1.1、简介 是Python的第三方模块,用于自动化生成或修改word文档,写入文本、图片、表格等常用办公必备功能。 官方文档地址:https://python-docx.readthedocs.io/en/latest/ 1.2、安装命令 pip install python-docx 1.3、使用方法 写入文本到word(符号“#”表示注释) ``` fr...……
阿星 - 2024年1月6日 18:28
随机字符生成
``` import random import string ran_str = ''.join(random.sample(string.ascii_letters + string.digits + string.punctuation, 20)) print (ran_str) string模块: ascii_letters 获取所有ascii码中字母字符的字符串(包含大写和小写) ...……
阿星 - 2024年1月6日 18:17
编码规范
Python 编程风格规范(Google) Google Style Guide站点:https://google.github.io/styleguide/ Google Python Style Guide英文版:https://google.github.io/styleguide/pyguide.html 以下代码中 Yes 表示推荐,No 表示不推荐。 命名 module_name...……
阿星 - 2024年1月6日 18:16
拼接字符串的7种方法
1、直接通过(+)操作符拼接 ```shell 'Hello' + ' ' + 'World' + '!' 'Hello World!' ``` 使用这种方式进行字符串连接的操作效率低下,因为python中使用 + 拼接两个字符串时会生成一个新的字符串,生成新的字符串就需要重新申请内存,当拼接字符串较多时自然会影响效率。 2、通过str.join()方法拼接 ```shell ...……
阿星 - 2024年1月6日 18:16