人生苦短,我用 Python
转载 2021-08-13 17:23:26
175阅读
多次 import import numpy as np, matplotlib.pyplot as plt ndarray 的强制类型转换 v = v.astype(np.int) python 的命名规范 类:首字母大写; 方法:首字母小写 txt.set_path_effects():单词之间用下划线分开;
转载 2016-10-26 11:00:00
58阅读
2评论
多次 import import numpy as np, matplotlib.pyplot as plt ndarray 的强制类型转换 v = v.astype(np.int) python 的命名规范 类:首字母大写; 方法:首字母小写 txt.set_path_effects():单词之间用下划线分开;
转载 2016-10-26 11:00:00
59阅读
2评论
 Python Tricks 若干赵斌 — APRIL 29, 2015 在 python 代码中可以看到一些常见的 trick,在这里做一个简单的小结。json 字符串格式化在开发 web 应用的时候经常会用到 json 字符串,但是一段比较长的 json 字符串是可读性较差的,不容易看出来里面结构的。 这时候就可以用 python 来把 json 字符串漂亮的打印出来。ro
原创 2015-05-08 19:52:44
369阅读
2点赞
1评论
赵斌 — APRIL 29, 2015 在 python 代码中可以看到一些常见的 trick,在这里做一个简单的小结。json 字符串格式化在开发 web 应用的时候经常会用到 json 字符串,但是一段比较长的 json 字符串是可读性较差的,不容易看出来里面结构的。 这时候就可以用 python 来把 json 字符串漂亮的打印出来。root@Exp-1:/tmp# ca
原创 2015-05-09 08:41:34
436阅读
2点赞
1评论
Python Tricks: The Power Of DecoratorsAt their core, Python’s decorators allow you to extend and modify the behavior of a callable(functions
原创 2024-04-16 10:44:04
35阅读
2021 5月 砍树 把答案写成一个式子,尝试推式子或观察 7~8月 简单的区间 卡常 处理式子:考虑变量和不变量,尝试枚举范围小的变量 & DS统计其他的 在线不好做的考虑离线,不只是多次询问 不好判区间左右端点相等的情况时先不管,最后减 \(n\) 组询问 \(\sum_{i=l}^r[a_i= ...
转载 2021-07-15 22:50:00
101阅读
由于本人着实有些菜,因此在此积累一些巧妙的 \(Tricks\) ,以备不时之需。。。 数学 组合数 不相邻的组合数 从 \(n\) 个球中选出 \(k\) 个球,要求所选的球两两不相邻,问有多少种选择的方法。 可以先从 \(n\) 个球中除去 \(k-1\) 个球,然后这 \(n-k+1\) 个球 ...
转载 2021-09-06 19:41:00
54阅读
2评论
1、当你想要保证每个点只被覆盖一次…… 直接用 vis 数组是不行的 因为每个点的 vis 被修改过一次,每次被修改都会有n次操作…… 所以可以用“链表(Cyber_Tree语)”“并查集(Rings语)”优化修改过程,使每次操作完一个数就跳过这个数。 要我起个名字的话,就叫他“过河拆桥”吧。。。 ...
转载 2021-09-11 18:33:00
65阅读
2评论
一 输入信息预处理二 Replay Buffer三 SemiGradient Method
原创 2021-08-02 14:58:26
344阅读
TricksTricksTricks1.mosaic
原创 2021-08-02 15:04:54
305阅读
Python Tricks: Fun With *args and **kwargsI once pair-programmed with a smart Pythonista who would exclaim “argh!” a
原创 2024-04-16 10:43:07
18阅读
Python Tricks: Complacent Comma PlacementHere’s a handy tip for when you’re adding and removing items from a list, dict, or set constant in Pyt
原创 2024-04-16 10:48:28
27阅读
简介with是从2.5版本引入的一个语法. 这个语法本身是为了解决try..finally繁琐的释放各类资源(文件句柄, Lock等)的问题.如果想在旧版本中使用这个功能, 直接引入future模块就可以. from __future__ import with_statement 举例简单说明一下没有with和有with的代码区别 try: dict_file = open("di
转载 2024-07-04 11:11:46
52阅读
记录Python中常用的一些函数,备查
原创 2022-08-04 18:41:21
21阅读
Python Tricks: Nothing to Return HerePython adds an implicit return None statement to the end of any function. Therefore, if a function doesn’t specify a retur
原创 2024-04-16 10:42:30
7阅读
Python Tricks: Function Argument UnpackingA really cool but slightly arcane feature is the ability to “unpack” funciton arguments from sequ
原创 2024-04-16 10:42:35
13阅读
Python tricks: Context Managers and the with StatementThe with statement in Python is regarded as an obscure feature by some. But when
原创 2024-04-16 10:48:25
11阅读
in plane.lua:-- Just a quick example to show that the virtual    -- machine is global to all script currently     -- compiled. If you want to reset the VM and  
原创 2009-12-13 10:46:48
430阅读
Add shadow to UIScrollViewscroll1.layer.shadowColor = [UIColor blackColor].CGColor; scroll1.layer.shadowRadius = slider.value; scroll1.layer.shadowOpacity = slider.value; scroll1.layer.masksToBounds = NO; // This is importantscroll1.layer.masksToBounds = NO; // This is importantUIScrollView...
原创 2021-07-05 13:16:08
306阅读
  • 1
  • 2
  • 3
  • 4
  • 5