- 军军小站|张军博客
搜索到与相关的文章
Python

Python 获取新浪微博的最新公共微博实例分享

API:statuses/public_timeline返回最新的200条公共微博,返回结果非完全实时CODE:#!/usr/bin/python#-*-coding:utf-8-*-'''Createdon2014-7-3@author:guaguastd@name:statuses_public_timeline.py'''defpublic_timeline(weibo_api,count):#public_timeline=weibo_api.st

系统 2019-09-27 17:48:06 1739

Python

如何在 Apache Flink 中使用 Python API?

本文根据ApacheFlink系列直播课程整理而成,由ApacheFlinkPMC,阿里巴巴高级技术专家孙金城分享。重点为大家介绍FlinkPythonAPI的现状及未来规划,主要内容包括:ApacheFlinkPythonAPI的前世今生和未来发展;ApacheFlinkPythonAPI架构及开发环境搭建;ApacheFlinkPythonAPI核心算子介绍及应用。一.ApacheFlinkPythonAPI的前世今生和未来发展1.Flink为什么选择

系统 2019-09-27 17:48:03 1739

Python

python如何读取bin文件并下发串口

下面是实现代码#coding:utf-8importtime,serialfromstructimport*importbinasciifile=open('E:\\1.bin','rb')i=0while1:c=file.read(1)#将字节转换成16进制;ssss=str(binascii.b2a_hex(c))[2:-1]print(str(binascii.b2a_hex(c))[2:-1])ifnotc:breakser=serial.Seri

系统 2019-09-27 17:48:02 1739

Python

Python 列表去重去除空字符的例子

如下所示:#x=['cba',"edf"]#y=[]#foriinx:#foriiini:##print(ii)#ifii=='':#pass#else:#y.append(ii)#print(y)#python清除列表中的空字符#list1=['122','2333','3444','','422','','','54','']#第一种方法会导致最后一个''没有被移除掉['122','2333','3444','422','54','']#forxinl

系统 2019-09-27 17:47:59 1739

Python

python实现ip代理池功能示例

本文实例讲述了python实现ip代理池功能。分享给大家供大家参考,具体如下:爬取的代理源为西刺代理。用xpath解析页面用telnet来验证ip是否可用把有效的ip写入到本地txt中。当然也可以写入到redis、mongodb中,也可以设置检测程序当代理池中的ip数不够(如:小于20个)时,启动该脚本来重新获取ip,本脚本的代码也要做相应的改变。#!/usr/bin/envpython#-*-coding:utf-8-*-#@Version:1.0#@T

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

Python

python调用短信猫控件实现发短信功能实例

python调用短信猫控件实现发短信功能实例代码如下所示:#!/usr/bin/envpython#coding=gbkimportsysimportwin32com.clientocxname='ShouYan_SmsGate61.Smsgate'axocx=win32com.client.Dispatch(ocxname)axocx.CommPort=8#设置COM端口号axocx.SmsService='+8613800100500'#设置短信服务号

系统 2019-09-27 17:47:54 1739

Python

Python Threading 线程/互斥锁/死锁/GIL锁

导入线程包importthreading准备函数线程,传参数t1=threading.Thread(target=func,args=(args,))类继承线程,创建线程对象classMyThread(threading.Thread)defrun(self):passif__name__=="__main__":t=MyThread()t.start()线程共享全面变量,但在共享全局变量时会出现数据错误问题使用threading模块中的Lock类,添加互

系统 2019-09-27 17:47:40 1739

Python

学会爬虫抓取竞争对手数据,《Python3网络爬虫开发实战》PDF高清+源码

众所周知python的拿手好戏就是爬虫抓取数据,性能优秀,抓取时间快,消耗低,这是python的优势。学会了爬虫后那我们就可以抓取竞争对手的数据,可以对数据进行分析,或者拿来使用(作者不赞成这样做哦)。最重要是对数据进行分析,这样对我们的运营自己的产品,提高用户的新增或留存都是很有帮助的,正所谓现在是大数据年代,没有数据我们也能利用别人的数据。那要怎样才能更好去学习python爬虫呢?今天推荐一本最新使用python3的书籍,值得阅读。《Python3网络

系统 2019-09-27 17:47:38 1739

Python

python中sort和sorted排序的实例方法

Pythonlist内置sort()方法用来排序,也可以用python内置的全局sorted()方法来对可迭代的序列排序生成新的序列。1)排序基础简单的升序排序是非常容易的。只需要调用sorted()方法。它返回一个新的list,新的list的元素基于小于运算符(__lt__)来排序。>>>sorted([5,2,3,1,4])[1,2,3,4,5]你也可以使用list.sort()方法来排序,此时list本身将被修改。通常此方法不如sorted()方便,

系统 2019-09-27 17:47:37 1739

Python

python中的内置函数getattr()介绍及示例

在python的官方文档中:getattr()的解释如下:getattr(object,name[,default])Returnthevalueofthenamedattributeofobject.namemustbeastring.Ifthestringisthenameofoneoftheobject'sattributes,theresultisthevalueofthatattribute.Forexample,getattr(x,'fooba

系统 2019-09-27 17:47:19 1739