共 192 篇文章 |
|
一文认清Python全局变量的使用方法1.Python全局变量简介。在 Python 中,全局变量是在任何函数外部声明的变量,使其可以从代码中的任何位置访问。但是,需要使用global关键字来表明您打算使用全局变量,而不是创建新的局部变量。defmodify_global(): global global_var global_var += 5modify_global() print(global_var) # 输出:155. 全局关... 阅3 转0 评0 公众公开 24-03-08 09:55 |
Python While LoopPython While Loop – 初学者完整指南洪较瘦不着调退役it人2023-10-13 11:08Python While Loop – 初学者完整指南。带有 while 循环和 else 语句1. 什么是 Python While Loop?'')) dbgprint(''Range: %d - %d'' % (r1, r2))num = r1 + 1count = 0while num <r2: dbgprint(''num: %d'... 阅1 转0 评0 公众公开 24-01-06 15:48 |
一个神奇的Python库:Evidently,机器学习必备“Evidently 是一个面向数据科学家和机器学习工程师的开源 Python 库。安装&使用pip install evidentlypip install jupyter# 安装 jupyter Nbextionpip install jupyter_contrib_nbextensions# 在 jupyter 扩展中安装并启用 evidentlyjupyter nbextension install --sys-prefix --symlink --ov... 阅1 转0 评0 公众公开 23-12-16 10:19 |
Brick(figsize=(3,2))sns.lineplot(x=''''''''timepoint'''''''', y=''''''''signal'''''''', hue=''''''''region'''''''', style='... 阅9 转0 评0 公众公开 23-12-16 10:19 |
PEP 465 矩阵乘法运算符。https://www.python.org/dev/peps/pep-0484/# 3.7前合法class Tree: def __init__(self, left: ''Tree'', right: ''Tree''): self.left = left self.right = right# 3.7前不合法、3.7后合法class Tree: def __init__(self, left: Tree, right: Tree): sel... 阅2 转0 评0 公众公开 23-12-14 09:24 |
给 Python 算法插上性能的翅膀——pybind11 落地实践腾讯技术工程2021-12-22 17:53.Python 端回调接口:def on_decoding_callback(task_id:str, progress:int): print(''decoding callback, task id: %s, progress: %d'' % (task_id, progress))if __name__ == ''__main__'': decoder = DecoderWrapper() deco... 阅29 转0 评0 公众公开 23-12-14 09:24 |
- Zen of Python。再说一点,实际上,大部分人吐槽 GIL 的点,并非是 Python 程序本身并发效率的问题,而是大多数对于计算速度有要求的库都是 Python 调用 C/C++,而 GIL 限制了你在调用 C/C++ 时也只能真正同时运行一个线程。无论结果如何,我作为一个被 Python 领进门的、被 Python 各种骚操作种草的、到现在不管后端服务还是客户端脚本还是... 阅9 转0 评0 公众公开 23-12-14 09:01 |
point_symbol_map(polygons, multipolygons, center_poly, center_multipoly, attribute_poly_m, attribute_multipoly_m, attribute_low=100, attribute_high=1000, tick_size=4, edgecolor_map = ''darkblue'', facecolor_map = ''#ECECEC'', alpha_map = 0.4, alpha_circle = 0.3, alpha_grid = 0.5, attrib... 阅11 转0 评0 公众公开 23-12-14 09:01 |
3分钟了解Python中的作用域自由坦荡的湖泊AI2023-10-2 06:05.嵌套作用域(Enclosing):包含了非局部 (non-local)也非全局 (non-global)的变量。比如两个嵌套函数,一个函数(或类) A 里面又包含了一个函数 B ,那么对于 B 中的名称来说 A 中的作用域就为 nonlocal。全局作用域(Global):当前脚本的最外层,比如当前模块的全局变量。 阅3 转0 评0 公众公开 23-11-25 10:18 |
手把手教你使用Python抓取QQ音乐数据(第三弹)Python进阶学习交流2020-4-25 21:24.通过手把手教你使用Python抓取QQ音乐数据(第二弹)我们实现了获取 QQ 音乐指定歌曲的歌词和指定歌曲首页热评。def get_comment(i): url_3 = ''https://c.y.qq.com/base/fcgi-bin/fcg_global_comment_h5.fcg'' headers = {''user-agen... 阅40 转0 评0 公众公开 23-11-08 17:53 |