摘要: 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("%... 阅读全文
posted @ 2019-05-22 17:16 hejp 阅读(137) 评论(0) 推荐(0) 编辑
摘要: import time length = 19 count = 0 while True: print('\r%s@%s' % ('#' * count, '#' * (length - count)), end='') try: time.sleep(0.3) except KeyboardInt 阅读全文
posted @ 2019-05-22 17:15 hejp 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2019-05-22 17:14 hejp 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 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: 阅读全文
posted @ 2019-05-22 17:14 hejp 阅读(179) 评论(0) 推荐(0) 编辑
摘要: randpass模块参见 https://www.cnblogs.com/hejianping/p/10881293.html 脚本名字:adduser.py 阅读全文
posted @ 2019-05-22 10:50 hejp 阅读(376) 评论(0) 推荐(0) 编辑
摘要: import sys import keyword import string first_chs = string.ascii_letters + '_' all_chs = first_chs + string.digits def check_id(idt): if keyword.iskey 阅读全文
posted @ 2019-05-22 09:46 hejp 阅读(223) 评论(0) 推荐(0) 编辑