python,你我日常办公用到的功能

python操作Excel

如果实在想扩展功能,我选择 xlwings:简单强大,可替代VBA

1  安装 python 3.6.

2  进入 cmd  ,pip  install  xlwings

3 安装是出了问题:  由于安装的时候 默认安装在 c:\program  files\...中,这个路径路径中有空格,安装 xlwings是没有成功l

解决步骤: 重新安装python,安装在没有空格的路径中

4  import  xlwings  as wb 时候报错: No module named 'win32api'

Python是没有自带访问windows系统API的库的,需要下载。库的名称叫pywin32,

解决方案:  pip install pypiwin32

种方式让python 与 Excel 交互:

参加:http://docs.xlwings.org/en/stable/quickstart.html

第一种: 在python中操作Excel, 这种操作l时候,需要打开Excel ,打开这个xls文件,才能操作。

第二种: 在VBA中调用 python。(启用宏的Excel文件”(xlsm格式)

准备工作: To get access to the RunPython function, you’ll need the xlwings addin (or VBA module), see Add-in.

1 要在Excel中增加Addin
xlwings addin install.安装 addin 。注意重启动计算机
Open Excel workbook and press Alt + F11 to get Visual Basic Editor (VBE)
Go to the Tools menu and select References from the drop down menu.
References- VBAProject” dialog will appear.

Reference Libraries


2 如何增加 VBAmodule,网上说;    http://blog.csdn.net/qq_34893405/article/details/53610046


3 如果要在Excel增加按钮之类的操作:可以在菜单中增加“” 开发工具“这题菜单”
参考:  https://jingyan.baidu.com/article/363872ec326f236e4ba16f0b.html

python 操作 csv文件

import csv     很多的场合,只需要直接读取CSV文件,内置的csv模块可以用的上。

python操作word


python操作数据库

mysql 安装驱动

pip install mysql-connector-python --allow-external mysql-connector-python

python 操作sqlLite3

由于SQLite的驱动内置在Python标准库中,所以我们可以直接来操作SQLite数据库。

import sqllite3

python 常见的 OS操作

import  os

os.mkdir()




评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值