python3
再敲行代码
这个作者很懒,什么都没留下…
展开
-
python修改config
config[sensor]light = 332temperature = 13humidity = 42mq2 = 17mq9 = 60 [sensor2]new_key = new_valueimport os from configparser import ConfigParser conf_path = "config.ini" #配置文件路径config = ConfigParser()config.read(conf_path, encoding="u原创 2021-01-25 22:24:16 · 1715 阅读 · 0 评论 -
Python生成前端标签代码
def tag(name, *content, cls=None, **attrs): """生成一个或者多个标签""" if cls is not None: attrs['class'] = cls if attrs: attr_str = ''.join(' %s="%s"' % (attr, value) for attr, value in sorted(attrs.items())) .原创 2020-08-02 15:42:07 · 492 阅读 · 0 评论 -
在命令行导入自己写方法
第一种方法是将方法储存到Python的安装目录第二种方法:import syssys.path.extend('文件所在的目录')// 再导入模块import 模块原创 2020-08-02 15:39:08 · 161 阅读 · 0 评论 -
获取当月第一天和最后一天
当月开始第一秒:_date = datetime.date.today().replace(day=1).strftime('%Y-%m-%d %H:%M:%S')当月最后一秒:_end_time = (str(last_day_of_month(datetime.date.today())) + ' ' + '23:59:59')def last_day_of_...原创 2020-04-29 10:11:15 · 992 阅读 · 0 评论 -
windows下通过cmd切换python2和python3版本
找到python3.7的安装路径 将python.exe改为python3.exepython2配置同理解决 Fatal error in launcher: Unable to create process using使用 python3 -m pip install --upgrade pip 升级pip...原创 2019-09-10 22:24:06 · 1116 阅读 · 0 评论