import BeautifulSoup # 报错,找不到模块 # 命令行进入python,使用help('modules'),发现名字为bs4
expression and truevalue or falsevalue
a = reduce(lambda x, y: x > y and x or y, [9, 7, 9, 8, 100])
command “python setup.py egg_info” failed with error code 1 in …
解决方法:
pip install distribute
chmod +x intelserver
nohup ./intelserver -p 1666 -u zx >zx.out 2>&1 &
enumerate将其组成一个索引序列,利用它可以同时获得索引和值
for lineno, line in enumerate(self.lines, 1): 迭代器切片
for x in itertools.islice(c, 10, 20): 跳过可迭代对象的开始部分
for line in dropwhile(lambda l: l.startswith('#'), f): 跳过所有#开头字符串
lines = (line for line in f if not line.startswith('#')) 排列迭代
for p in permutations(items, 2): 组合迭代
for c in combinations(items, 2): for c in combinations_with_replacement(items, 2): 同时迭代多个序列
for xv, yv in zip(x, y): 迭代多个序列,短的序列补0
for xv, yv in zip_longest(x, y, fillvalue=0): 不同集合上元素的迭代
for x in chain(a, b): 按顺序迭代已排序序列
Read More →