Python知识点
文章平均质量分 59
通宵达旦的程序员
这个作者很懒,什么都没留下…
展开
-
python获取本机IP地址最好用的方法
import socket def get_my_ip(): """ Returns the actual ip of the local machine. This code figures out what source address would be used if some traffic were to be sent out to some well known address on the Internet. In this case, a Googl...原创 2021-05-28 17:49:29 · 129 阅读 · 0 评论 -
python 并发 ThreadPoolExecutor
python 并发 ThreadPoolExecutor 正文: Executor是一个抽象类,子类: ThreadPoolExecutor和ProcessPoolExecutor ,一个线程池,一个进程池. future对象:在未来的某一时刻完成操作的对象. submit方法可以返回一个future对象,此对象直接返回,等线程函数执行完后把return的数据再set_result到future对象中; 下面实现了submit, map 与 as_completed的差别 , 下面的例子中都没有使.转载 2021-03-17 15:56:59 · 606 阅读 · 0 评论 -
对python async与await的理解
喝水不忘挖井人,原文链接:https://www.cnblogs.com/xinghun85/p/9937741.html async/await关键字是出现在python3.4以后。网上已经有很多文章对async/await这两个关键字都有讲解,包括如何由python2的yield from发展到async/await这两个关键字,以及一些代码实现都有。但是对于像我这样初次接触的人来说,光看代码分析也不一定能理解,我也是在度娘上搜索很多相关的网站,当中也有官网,都没有发现能让我一眼看懂...转载 2021-03-17 10:31:48 · 481 阅读 · 1 评论