Saturday, July 27, 2019

markdown

换行单倍行距:按键 space, space, enter
换行双倍行距:按键 enter, enter

Thursday, July 11, 2019

useful python tricks

tqdm 进度条控制器

from tqdm import tqdm

from time import sleep
for i in tqdm(range(1, 500)):

... sleep(0.01)

打印python 结果:
print("current line count %d"%(line_count))
print(f"current line count {line_count}")
print("current line count {}".format(line_count))

如何写logging 的正确方法 以及和yaml的结合
https://cuiqingcai.com/6080.html
https://juejin.im/post/5bc2bd3a5188255c94465d31
https://www.cnblogs.com/yyds/p/6901864.html

如何写exception 和 raise, assert, 和 warning:
https://blog.csdn.net/u013982161/article/details/53453979
https://blog.csdn.net/IllegalName/article/details/77446428


__init__.py的作用


python中,类方法和静态方法区别:https://blog.csdn.net/lihao21/article/details/79762681
为什么用类方法和静态方法:
https://www.zhihu.com/question/20021164
https://zhuanlan.zhihu.com/p/35643573
https://foofish.net/different_bettween_classmethod_and_staticmethod.html

python 类变量和实例变量:http://kuanghy.github.io/2015/12/19/python-variable

__init__.py 的解释:
https://www.cnblogs.com/Lands-ljk/p/5880483.html
https://python3-cookbook.readthedocs.io/zh_CN/latest/c10/p01_make_hierarchical_package_of_modules.html


python 中@ 的用法:https://blog.csdn.net/u012759262/article/details/79749299

python 装饰器,*args **kwargs : https://blog.csdn.net/tianbwin2995/article/details/50863940

__init__, __new__, __call__ 函数 function 解析:https://blog.csdn.net/junxieshiguan/article/details/82502437

python yield 关键字:
yield是用于生成器。什么是生成器,你可以通俗的认为,在一个函数中,使用了yield来代替return的位置的函数,就是生成器。它不同于函数的使用方法是:函数使用return来进行返回值,每调用一次,返回一个新加工好的数据返回给你;yield不同,它会在调用生成器的时候,把数据生成object,然后当你需要用的时候,要用next()方法来取,同时不可逆。你可以通俗的叫它"轮转容器",可用现实的一种实物来理解:水车,先yield来装入数据、产出generator object、使用next()来释放;好比水车转动后,车轮上的水槽装入水,随着轮子转动,被转到下面的水槽就能将水送入水道中流入田里
https://www.ibm.com/developerworks/cn/opensource/os-cn-python-yield/index.html
https://www.cnblogs.com/neightchen/p/6669659.html
python deque 从两端都可以加入




很多小的function
https://www.1point3acres.com/bbs/thread-543794-1-1.html





















Wednesday, June 12, 2019

vim 总结



toturial: https://vimhelp.org/





vim - A modal editor based on the classic ‘vi’ editor by Bill Joy.


Vim quick reference


Changing modes


Enter command mode: :


Enter typing mode: i (insert at cursor), a (append after cursor), A (append at end of line)


Exit command or typing mode: ESC


Moving (you must not be in command or typing mode)


By line or column: use the arrow keys or h (left), j (down), k (up), l (right)


Go to beginning/end of line: 0 or $


Go to beginning/end of file: 1G or G


Go to particular line: type the linenumber and press G


Prev/next word: gE or W


Beginning/end of word: e or b


Search: /search term or regex


Opening, saving and closing files


Open a file: :e filename or path


Save and exit: :x


Save without exiting: :w


Exit without saving: :q!


Getting help


In-editor help: :help





The less command allows you to use these key-commands to move around the file
x