后台做数据分析汇总的时候需要处理各种时间段,每天的零点、每周的第一天最后一天、每月的第一天最后一天等,不知道有没有现成的可用库来处理。搜索的基本也是各种其他人写的方法,我这里汇总了一下(抄了一些代码)。
日期处理一般会用到下面几个库:time,datetime,calendar。一般通过这几个库来处理时间也够用了。
time 模块
该模块包括使用时间执行各种操作所需的所有与时间相关的功能,它还允许我们访问多种用途所需的时钟类型。
后台做数据分析汇总的时候需要处理各种时间段,每天的零点、每周的第一天最后一天、每月的第一天最后一天等,不知道有没有现成的可用库来处理。搜索的基本也是各种其他人写的方法,我这里汇总了一下(抄了一些代码)。
日期处理一般会用到下面几个库:time,datetime,calendar。一般通过这几个库来处理时间也够用了。
该模块包括使用时间执行各种操作所需的所有与时间相关的功能,它还允许我们访问多种用途所需的时钟类型。
今天在windows电脑上安装django-export-xls的时候报错了:
(venv) PS F:\Pycharm_Projects\Ruoyi-Energy> pip3 install django-export-xls Collecting django-export-xls Using cached django-export-xls-0.1.1.tar.gz (3.2 kB) Preparing metadata (setup.py) ... error ERROR: Command errored out with exit status 1: obaby\AppData\Local\Temp\pip-pip-egg-info-u0lvqod1' cwd: C:\Users\obaby\AppData\Local\Temp\pip-install-xrhra6sx\django-export-xls_d72b66d322264c26b516fda785f307fd\ Complete output (5 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\obaby\AppData\Local\Temp\pip-install-xrhra6sx\django-export-xls_d72b66d322264c26b516fda785f307fd\setup.py", line 4, in <module> README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 918: illegal multibyte sequence ----------------------------------------
python读写csv是非常方便的,但是读写xls就稍微麻烦一些,涉及到行和列的问题。为了导出数据,搜了一下找到这么个插件:https://github.com/Daiech/django-export-xls,集成非常简单,只需要下面几步就ok了:
1. 安装:: $ pip install django-export-xls 2. 将"export_xls" 添加到 INSTALLED_APPS:: INSTALLED_APPS = ( ... 'export_xls', ) 3. 修改以下两个路径MEDIA_ROOT 和MEDIA_URL eg:: import os MEDIA_ROOT = os.sep.join([os.path.dirname(os.path.dirname(__file__)), 'media']) MEDIA_URL = '/media/' 4. 执行数据导出: 定义以下几个数据:文件名、表头、导出数据
uptime-kuma是一款开源监控工具,类似于“Uptime Robot和statping”,ui非常简洁美观,支持TCP/PING/HTTP监控等,还支持多语言其中包括中文!
项目:https://github.com/louislam/uptime-kuma
Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.
The MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.
The Mosquitto project also provides a C library for implementing MQTT clients, and the very popular mosquitto_pub and mosquitto_sub command line MQTT clients.
最近需要用mqtt来实现消息处理,在windows上安装Mosquitto之后,不使用用户名密码提示connection refused: not authorised。结果添加用户名密码之后还是提示同样的错误。