Interview
Python
1. Do you know python comprehensions? list comprehensions
https://www.runoob.com/python3/python-comprehensions.html
[表达式 for 变量 in 列表]
[out_exp_res for out_exp in input_list]
2. Do you know python closure? https://github.com/Jwindler/Ice_story/blob/main/src/python/closure.md
闭包(closure)是一个函数对象,它与它的环境变量(包括自由变量)的引用组合而成的实体。
闭包可以保留函数定义时所在的...
EAP
soruce
EAP
This document defines the Extensible Authentication Protocol (EAP),
an authentication framework which supports multiple authentication
methods. EAP typically runs directly over data link layers such as
Point-to-Point Protocol (PPP) or IEEE 802, without requiring IP.
EAP (Extensible Authentication Protocol)
provides its own supp...
Shell Misc
soruce
soruce
grep 零宽断言
grep高级用法——断言
先行断言 x(?=y)
当x的右边是y是匹配成功
后发断言 (?<=y)x
当x的左边是y时匹配成功
负向零宽先行断言 x(?!y)
x右边不是y时匹配成功
负向零宽后发断言 (?<!y)x
x左边不是y时匹配成功
需要使用-P选项
[root@liali-vm1 job_scheduler]# grep -P -o "(?<=SKIP_DRIVER\=\").*?(?=\")" -R list/
list/sriov.list:bnx2x
list/sriov.list:igb
list/sriov.list:bnx2x
list/sriov.list:bnx2x
list/s...
decorator
soruce
基本的装饰器
概括的讲,装饰器的作用就是为已经存在的函数或对象添加额外的功能。
def debug(func):
def wrapper(*args, **kwargs): # 指定宇宙无敌参数
print "[DEBUG]: enter {}()".format(func.__name__)
print 'Prepare and say...',
return func(*args, **kwargs)
return wrapper # 返回
@debug
def say(something):
print "hello {}!".format(something)
带参数的装饰...
import
soruce
import 整个模块(需要使用前缀)
# 导入sys整个模块
import sys
# 使用sys模块名作为前缀来访问模块中的成员
print(sys.argv[0])
# 导入sys、os两个模块
import sys,os
设置别名(需要使用前缀)
# 导入sys整个模块,并指定别名为s
import sys as s
# 使用s模块别名作为前缀来访问模块中的成员
print(s.argv[0])
# 导入sys、os两个模块,并为sys指定别名s,为os指定别名o
import sys as s,os as o
from xx import x1(无须使用任何前缀)
# 导入sys模块的argv成员
from sys import argv
# 使用...
pandas
soruce
import
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import LabelEncoder
read file
train = pd.read_csv("/kaggle/input/store-sales-time-series-forecasting/train.csv")
test = pd.read_csv("/kaggle/...
fastai notebook - NLP
soruce
Tokenization
Word-based:: Split a sentence on spaces, as well as applying language-specific rules to try to separate parts of meaning even when there are no spaces (such as turning “don’t” into “do n’t”). Generally, punctuation marks are also split into separate tokens.
Subword based:: Split words into smaller parts, based on the most co...
共计 106 篇文章,14 页。