标签:print col class orm where val ike 代码 split
def show(con,col_l,symbol,condition): con_name, con_value = con.split(symbol) # con_name = ‘age‘,con_value = 20 for line_lst in read_file(): num = name_value[con_name] # num = 2 if eval(condition): for col in col_l: # [‘name‘,‘age‘] print(line_lst[name_value[col]], end=‘ ‘) print() def select(sql): # sql = ‘select name,age where age>20‘ col_l, con = format_sql(sql) # col_l = [‘name‘, ‘age‘],con = age>20 if ‘>‘ in con: show(con,col_l,‘>‘,‘int(con_value) < int(line_lst[num])‘) if ‘<‘ in con: show(con, col_l, ‘<‘, ‘int(con_value) > int(line_lst[num])‘) if ‘=‘ in con: show(con, col_l, ‘=‘, ‘con_value == line_lst[num]‘) if ‘like‘ in con: show(con, col_l, ‘like‘, ‘con_value in line_lst[num]‘)
标签:print col class orm where val ike 代码 split
原文地址:https://www.cnblogs.com/zhangzhaohua/p/10011455.html