搜索到与相关的文章
Python

Python进程间通信Queue消息队列用法分析

本文实例讲述了Python进程间通信Queue消息队列用法。分享给大家供大家参考,具体如下:进程间通信-QueueProcess之间有时需要通信,操作系统提供了很多机制来实现进程间的通信。1.Queue的使用可以使用multiprocessing模块的Queue实现多进程之间的数据传递,Queue本身是一个消息列队程序,首先用一个小实例来演示下Queue的工作原理:代码如下:#coding=utf-8frommultiprocessingimportQue

系统 2019-09-27 17:52:28 2114

Python

module in Python i...

转:https://www.jianshu.com/p/4be85de84d2a本机环境:Windows1064位Anacondapython3.7报错信息:pipisconfiguredwithlocationsthatrequireTLS/SSL,howeverthesslmoduleinPythonisnotavailable.解决方法:原因:Anaconda环境变量未配置完全需要配置的环境变量:D:\ProgramData\Anaconda3D:\

系统 2019-09-27 17:50:37 2114

Python

python & django logging 小结

python&djangologging小结[TOC]python基本一次配置,多处生效importlogginglogging.basicConfig(format='%(asctime)s%(message)s',datefmt='%m/%d/%Y%I:%M:%S%p')logging.warning('iswhenthiseventwaslogged.')>>>12/12/201011:46:36AMiswhenthiseventwaslogged.

系统 2019-09-27 17:50:19 2114

Python

Python+OpenCV调用摄像头接口打造家庭安防系统

问题描述:使用Python+opencv调用笔记本摄像头接口,定期捕捉图像或录制视频并保存为图像文件或视频文件。可以在家里没有人的时候使用该程序监视家中是否有小偷进入或者宠物们有没有搞破坏。关注微信公众号“Python”阅读原文

系统 2019-09-27 17:49:51 2114

Python

Python with用法实例

python中with可以明显改进代码友好度,比如:复制代码代码如下:withopen('a.txt')asf:printf.readlines()为了我们自己的类也可以使用with,只要给这个类增加两个函数__enter__,__exit__即可:复制代码代码如下:>>>classA:def__enter__(self):print'inenter'def__exit__(self,e_t,e_v,t_b):print'inexit'>>>withA()

系统 2019-09-27 17:49:50 2114

Python

Python中的ConfigParser模块使用详解

1.基本的读取配置文件-read(filename)直接读取ini文件内容-sections()得到所有的section,并以列表的形式返回-options(section)得到该section的所有option-items(section)得到该section的所有键值对-get(section,option)得到section中option的值,返回为string类型-getint(section,option)得到section中option的值,返

系统 2019-09-27 17:48:26 2114

Python

Python itertools模块详解

这货很强大,必须掌握文档链接http://docs.python.org/2/library/itertools.htmlpymotw链接http://pymotw.com/2/itertools/基本是基于文档的翻译和补充,相当于翻译了itertools用于高效循环的迭代函数集合组成总体,整体了解无限迭代器复制代码代码如下:迭代器参数结果例子count()start,[step]start,start+step,start+2*step,...count

系统 2019-09-27 17:47:57 2114

Python

Python中__init__和__new__的区别详解

__init__方法是什么?使用Python写过面向对象的代码的同学,可能对__init__方法已经非常熟悉了,__init__方法通常用在初始化一个类实例的时候。例如:#-*-coding:utf-8-*-classPerson(object):"""SillyPerson"""def__init__(self,name,age):self.name=nameself.age=agedef__str__(self):return''%(self.name

系统 2019-09-27 17:47:53 2114

Python

python 之 Django框架(APP和ORM的使用)

12.3APP12.31创建APP一个Django项目可以分为很多个APP,用来隔离不同功能模块的代码用命令行创建一个APP:python3manage.pystartappapp01创建好APP,记得告诉Django,app的名字,在settings.py中添加:INSTALLED_APPS=['django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','djang

系统 2019-09-27 17:47:27 2114

Python

python实现监控linux性能及进程消耗性能的方法

本文以实例形式实现了python监控linux性能以及进程消耗性能的方法,具体实现代码如下:#-*-coding:utf-8-*-"""CreatedonTueJun1010:20:132014@author:lifeix"""fromcollectionsimportOrderedDictimporttimeimportosdefcpuinfo():lines=open('/proc/stat').readlines()forlineinlines:ln

系统 2019-09-27 17:47:12 2114