随笔分类 -  Python

摘要:#!/usr/bin/env python3 # -*- coding: utf-8 -*- import subprocess command = "df -Th" result = subprocess.Popen(command, shell=True, stdout=subprocess.P 阅读全文
posted @ 2022-10-10 12:01 捧花大王 阅读(414) 评论(0) 推荐(0) 编辑
摘要:#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # # Date : 2020-09-17 # # Author : Created by zhouwanchun. # # Wechat : WGzhouwanchu # # Function: Th 阅读全文
posted @ 2022-09-14 18:59 捧花大王 阅读(67) 评论(0) 推荐(0) 编辑
摘要:import tornado.httpserver import tornado.ioloop import tornado.options #从命令行中读取设置 import tornado.web from tornado.options import define, options defin 阅读全文
posted @ 2022-09-01 17:12 捧花大王 阅读(44) 评论(0) 推荐(0) 编辑
摘要:#!/usr/bin/env python # -*- coding: utf-8 -*- """ Desc: decrypt the db backup file, then to ungzip it , finally, to be a origin state. Date: 2016-08-1 阅读全文
posted @ 2022-08-22 17:20 捧花大王 阅读(34) 评论(0) 推荐(0) 编辑
摘要:[root@mysql-host1 ~]# cat 1.json {"version":"0.1","database":"app01","table":"tb1","type":"insert","ts":1659678099,"time_zone":"Asia/Shanghai","host": 阅读全文
posted @ 2022-08-15 14:10 捧花大王 阅读(158) 评论(0) 推荐(0) 编辑
摘要:#!/usr/bin/env python3 # -*- coding: utf-8 -*- 1、r读模式 # rb模式操作的文件是非文字类的文件:图片,视频,音频等等。 # read() read(n) readline() readlines() for循环 f1 = open('./zwc.t 阅读全文
posted @ 2021-02-21 22:39 捧花大王 阅读(59) 评论(0) 推荐(0) 编辑
摘要:os.sep 根据你的操作系统给出相应的分隔符,在 GNU/Linux 与 Unix 中它会是 '/',在 Windows 中它会是 '\\',在 Mac OS 中它会是 ':'。 [root@db01 ~]# vim 1.py #!/usr/bin/env python3 import os pr 阅读全文
posted @ 2020-10-23 14:19 捧花大王 阅读(223) 评论(0) 推荐(0) 编辑
摘要:DocStrings Python有一个甚是优美的功能称作文档字符串(Documentation Strings),在称呼它时通常会使用另一个短一些的名字docstrings。 DocStrings是一款你应当使用的重要工具,它能够帮助你更好地记录程序并让其更加易于理解。 令人惊叹的是,当程序实际运 阅读全文
posted @ 2020-10-23 14:09 捧花大王 阅读(153) 评论(0) 推荐(0) 编辑
摘要:Python如何获取脚本的参数 [root@db01 ~]# vim 1.py #!/usr/bin/env python3 import sys script_name = sys.argv[0] p1 = sys.argv[1] p2 = sys.argv[2] p3 = sys.argv[3] 阅读全文
posted @ 2020-10-23 12:52 捧花大王 阅读(510) 评论(0) 推荐(0) 编辑
摘要:使用Python打印进度条 周万春 import time for i in range(0,101,2): time.sleep(0.1) char_num = i//2 #打印多少个'*' per_str = '\r%s%% : %s\n' % (i, '*' * char_num) if i 阅读全文
posted @ 2020-05-22 19:29 捧花大王 阅读(355) 评论(0) 推荐(0) 编辑
摘要:在File—settings—Editor—File and Code Templates—Python script 脚本里添加 编辑内容 (a)shebang行 #!/usr/bin/python3 (b)预定义的变量要扩展为格式为$ {<variable_name>}的相应值。 可用的预定义文 阅读全文
posted @ 2019-01-05 14:25 捧花大王 阅读(384) 评论(0) 推荐(0) 编辑
摘要:编辑类: Ctrl + Space 基本的代码完成(类、方法、属性)Ctrl + Alt + Space 类名完成Ctrl + Shift + Enter 语句完成Ctrl + P 参数信息(在方法中调用参数)Ctrl + Q 快速查看文档Shift + F1 外部文档Ctrl + 鼠标 简介Ctr 阅读全文
posted @ 2019-01-05 14:03 捧花大王 阅读(136) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示