摘要:
业务需求,需要爬取英雄联盟英雄的符文图片,然后在把它们拼接回去。 以下是爬取单个英雄katarina的符文图片到本地的代码,爬取地址为: http://www.op.gg/champion/katarina/statistics/mid 要爬取的图片内容为: 阅读全文
摘要:
K8S服务部署安装: # 三台主机分别修改hostname # 修改hosts文件 # 关闭防火墙: # 创建/etc/sysctl.d/k8s.conf文件 # 执行命令使修改生效 # 1.2kube-proxy开启ipvs的前置条件: #所有节点关闭 swap修改/etc/fstab文件注销: 阅读全文
摘要:
adict = dict() # {} dict(['ab', 'cd']) bdict = dict([('name', 'bob'),('age', 25)]) {}.fromkeys(['zhangsan', 'lisi', 'wangwu'], 11) for key in bdict: print('%s: %s' % (key, bdict[key])) print("%... 阅读全文
摘要:
import time length = 19 count = 0 while True: print('\r%s@%s' % ('#' * count, '#' * (length - count)), end='') try: time.sleep(0.3) except KeyboardInt 阅读全文
摘要:
import sys def unix2dos(fname): dst_fname = fname + '.txt' with open(fname) as src_fobj: with open(dst_fname, 'w') as dst_fobj: for line in src_fobj: 阅读全文
摘要:
stack = [] def push_it(): item = input('item to push: ') stack.append(item) def pop_it(): if stack: print("from stack popped %s" % stack.pop()) def vi 阅读全文
摘要:
randpass模块参见 https://www.cnblogs.com/hejianping/p/10881293.html 脚本名字:adduser.py 阅读全文
摘要:
import sys import keyword import string first_chs = string.ascii_letters + '_' all_chs = first_chs + string.digits def check_id(idt): if keyword.iskey 阅读全文
摘要:
alist = [1,2,3,'bob','alice'] print(alist) alist[0] = 10 print(alist) alist[1:3] = [20,30] print(alist) alist[2:2] = [22,24,26,28] print(alist) alist.append(100) print(alist) alist.remove(24) pr... 阅读全文
摘要:
import os def get_fname(): while True: fname = input('filename: ') if not os.path.exists(fname): break print('%s already exists. Try again' % fname) ... 阅读全文