Python
Contents
String & Bytes
bytes to string
|
|
abc123
string to bytes
|
|
b'abc123'
Virtual Env
create
|
|
activate
|
|
deactivate
|
|
Arguments
argparse
|
|
File
file exists
|
|
parent dir
|
|
list directory
|
|
rename
|
|
path join
|
|
directory create
|
|
threads
thread pool
|
|
Random
choice
|
|
uuid
|
|
Data process
unique
|
|
Json
load from file
|
|
dump to file
|
|
dump class to file
|
|
load class from file
|
|
Time
|
|
None
duration
|
|
0.00015999830793589354
date
|
|
2024-04-25 20:05:59.259296
socket
server
|
|
client
|
|
class
super
理论上
super()
可以直接 call 嗷, 返回父类- 调用父类函数时候, self指向的是子类
多继承的时候, 直接
super().func()
会从 mro 中, 从第二个找拥有func()
的类- 如果使用
super(clazz, self).func()
则会从 clazz.mro 中的第二个类开始找
- 如果使用
enum
|
|
plot
- networkx → graphviz
networkx to graphviz
|
|
colormesh (heatmap)
|
|
standard deviation / std / error bar
|
|
dot
- example
|
|
cli
|
|
pandas
from list
|
|
to json
|
|
groupby
|
|
count
|
|
unique
|
|
reverse
|
|
to markdown
|
|
concat
|
|
horizontal
|
|
reset index
|
|
for loop/iterate
|
|
convert to numeric
|
|
drop
|
|
numpy
percent
|
|
std
|
|
type
return void
|
|
regex
|
|