随笔分类 -  Python

摘要:1. 常用模块:subprocess, requests, paramekio, traceback, argparse, numpy, pandas 2. 赋值传递和引用传递 python是赋值传递参数: https://blog.csdn.net/Ljj9889/article/details/ 阅读全文
posted @ 2022-11-26 11:35 i舒 阅读(23) 评论(0) 推荐(0) 编辑
摘要:两种方式: #!/usr/bin/env python3#coding:utf-8 import sys, inspectdef test_a(): print('func name: ', sys._getframe().f_code.co_name) def test_b(): print('f 阅读全文
posted @ 2022-10-25 23:20 i舒 阅读(42) 评论(0) 推荐(0) 编辑
摘要:https://wenku.baidu.com/view/f66dab004835eefdc8d376eeaeaad1f3469311b0.html 阅读全文
posted @ 2022-06-02 16:05 i舒 阅读(26) 评论(0) 推荐(0) 编辑
摘要:pip install setuptools 一个最基本的”setup.py”文件如下: #coding:utf8 from setuptools import setup setup( name='MyApp', # 项目名 version='1.0', # 版本号 packages=['myap 阅读全文
posted @ 2022-05-17 23:11 i舒 阅读(130) 评论(0) 推荐(0) 编辑
摘要:from distutils.core import setup from setuptools import find_packages setup(name="mytest", version="1.0.0", maintainer="sky", maintainer_email="sky@12 阅读全文
posted @ 2022-04-28 14:49 i舒 阅读(66) 评论(0) 推荐(0) 编辑
摘要:安装: pip3 install python-jenkins lxml Beautifulsoup4 jenkins_server_url = 'http://192.168.24.191:8080/jenkins/' user_id = 'testuser' api_token = '7ca1a 阅读全文
posted @ 2022-04-26 14:08 i舒 阅读(199) 评论(0) 推荐(0) 编辑
摘要:import argparse parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('integers', metavar='N', type=int, nargs='+ 阅读全文
posted @ 2022-04-25 20:10 i舒 阅读(23) 评论(0) 推荐(0) 编辑
摘要:_xx 使用_one_underline来表示该方法或属性是私有的,不属于API; __xx__当创建一个用于python调用或一些特殊情况时,使用__two_underline__; __xx 使用__just_to_underlines,来避免子类的重写(即子类不会重写该方法)! https:/ 阅读全文
posted @ 2021-06-24 08:09 i舒 阅读(91) 评论(0) 推荐(0) 编辑
摘要:Elementary knowledge of linux shell, python and robot Linux: https://www.linuxprobe.com/basic-learning-02.html Python: https://pythonbasics.org/ Robot 阅读全文
posted @ 2021-05-21 10:16 i舒 阅读(36) 评论(0) 推荐(0) 编辑
摘要:python 3.5 subprocess中新增run方法很好用: >>>a= subprocess.run("ls", stdout=subprocess.PIPE,stderr=subprocess.PIPE,encoding="utf-8")CompletedProcess(args='ls' 阅读全文
posted @ 2021-05-10 18:41 i舒 阅读(416) 评论(0) 推荐(0) 编辑
摘要:11 阅读全文
posted @ 2021-05-08 17:32 i舒 阅读(138) 评论(0) 推荐(0) 编辑
摘要:用 Python 快速实现 HTTP 服务器 有时你需临时搭建一个简单的 Web Server,但你又不想去安装 Apache、Nginx 等这类功能较复杂的 HTTP 服务程序时。这时可以使用 Python 内建的 SimpleHTTPServer 模块快速搭建一个简单的 HTTP 服务器。 Si 阅读全文
posted @ 2021-03-09 18:04 i舒 阅读(169) 评论(0) 推荐(0) 编辑
摘要:在logging模块中通过addHandler实现将log一边输出到log文件一边打印到屏幕: import logging #logging.basicConfig(level = logging.INFO,format = '%(asctime)s - %(name)s - %(levelnam 阅读全文
posted @ 2020-11-17 17:55 i舒 阅读(113) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/lch551218/article/details/105446636 python中的print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)函数的参数说明如下: 参数说明 obje 阅读全文
posted @ 2020-09-05 22:25 i舒 阅读(1716) 评论(0) 推荐(0) 编辑
摘要:最好用的是APScheduler定时框架 可以使用schedule和apschedule模块,其中最好用的是APScheduler定时框架 使用 APScheduler 需要安装 $ pip install apscheduler 首先来看一个周一到周五每天早上6点半定时打印的例子 from aps 阅读全文
posted @ 2020-06-18 13:32 i舒 阅读(2002) 评论(0) 推荐(0) 编辑
摘要:虽然非阻塞socket能够实现单process同时处理多个网络IO事件(client), 但是socket的setblocking是用不断轮询的方式来达到非阻塞处理client的, 所有难免会浪费CPU资源. 然而, epoll(epoll 为linux中效率最高的 IO多路复用), 计算机底层的机 阅读全文
posted @ 2020-06-18 11:20 i舒 阅读(212) 评论(0) 推荐(0) 编辑
摘要:#!/usr/bin/env python# -*- coding: utf-8 -*- import smtplibfrom email.mime.multipart import MIMEMultipartfrom email.mime.text import MIMETextfrom emai 阅读全文
posted @ 2019-11-14 22:52 i舒 阅读(1081) 评论(0) 推荐(0) 编辑
摘要:对几种算法做说明: 名称 复杂度 说明 备注 冒泡排序Bubble Sort O(N*N) 将待排序的元素看作是竖着排列的“气泡”,较小的元素比较轻,从而要往上浮 插入排序 Insertion sort O(N*N) 逐一取出元素,在已经排序的元素序列中从后向前扫描,放到适当的位置 起初,已经排序的 阅读全文
posted @ 2019-11-10 17:57 i舒 阅读(219) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/wongbingming/p/9035579.html 阅读全文
posted @ 2019-11-03 17:09 i舒 阅读(264) 评论(0) 推荐(0) 编辑
摘要:http://blog.sina.com.cn/s/blog_794c649401012r62.html https://blog.csdn.net/cslp517/article/details/54094818 阅读全文
posted @ 2019-09-09 13:16 i舒 阅读(153) 评论(0) 推荐(0) 编辑