摘要:
@property 把对象封装为属性,@classmethod 类对象 阅读全文
摘要:
import random def gen_check(): alpha_list = [i for i in range(65,123) if i96] check_str = "" for i in range(5): alpha = chr(random.choice(alpha_list )) check_str += str(ra... 阅读全文
摘要:
认证文件 {"username":"user1","pwd":123}{"username":"user2","pwd":123}{"username":"user3","pwd":123}{"username":"user4","pwd":123} 阅读全文
摘要:
方法1 2 3 阅读全文
摘要:
1 def read_data(): 2 with open("test","r",encoding="utf-8") as f : 3 for data in f: 4 yield data 5 6 g = read_data() 7 8 all_population = sum(eval(dt) 阅读全文
摘要:
1 f = open("text_file.txt","rb" ) 2 3 for ln in f: 4 offs = -10 5 while True: 6 print(offs) 7 f.seek(offs,2) 8 data = f.readlines() 9 if len(data) > 1 阅读全文
摘要:
1 def count_and_sum(start,end,a=0,b=0): 2 if start == end: 3 return a,b 4 5 if start%3 == 0 and start%7 == 0: 6 a += 1 7 b += start 8 9 return count_a 阅读全文
摘要:
#Author:xiesongyouChina= { '山东' : { '青岛' : ['四方','黄岛','崂山','李沧','城阳'], '济南' : ['历城','槐荫','高新','长青','章丘'], '烟台' : ['龙口','莱山','牟平','蓬莱','招远'] }, ' 阅读全文
摘要:
读取文件: 阅读全文
摘要:
#Atuhor:xiesongyoufor i in range(1,10): for j in range(1,i+1): print("%d * %d = %-8d"%(j,i,i*j),end="") print()print("- - " * 35)for i in range(9,0,-1 阅读全文