def commandword(): print(v.get()) commandword = v.get() process.calculate(commandword) # app1report.create_New_Toplevel_1(Tk(),commandword) os.startfile(os.getcwd() + "\\data1\\report_" + str(commandword) + ".dat")
def mapData(request): top = request.POST['top'] bottom = request.POST['bottom'] post_id = request.POST['id'] tp = top.split(',') bp = bottom.split(',') top_lat = float(tp[0][1:]) top_lon = float(tp[1][1:-1]) bot_lat = float(bp[0][1:]) bot_lon = float(bp[1][1:-1]) lat_dif = top_lat - bot_lat lon_dif = top_lon - bot_lon answer = process.calculate((top_lat,top_lon),lat_dif,lon_dif) new = Suggestion(unique = int(post_id), coordinates = str(answer)) new.save() return HttpResponse('success')
import tokenize import process if __name__ == '__main__': while True: input_str = input() if input_str in ["exit", "exit()", "quit", "quit()"]: break tokens = tokenize.tokenize(input_str) rpn = process.parse(tokens) print(">>", process.calculate(rpn))
args = vars(parser.parse_args()) just = Just(user_name, password, password_) # 网络有问题时,使用校园vpn try: just.login() except (rq.exceptions.ConnectionError, rq.exceptions.ConnectTimeout): just.enable_vpn() just.login() if args['command'] == 'grade': date = args['date'] # 判断date是否合法 if re.match(r'[2-9]\d{3}-2\d{3}-[12]', date): grades = just.get_grade(date) print(date + '平均绩点:' + str(calculate(grades))) if args['detail']: table_print(grades) elif re.match(r'[2-9]\d{3}-2\d{3}', date): year1, year2 = date.split('-') if int(year1) >= int(year2): raise RuntimeError(date + '日期不合法') else: # xxxx-xxxx的绩点计算 times = [] all_grades = [] term = 1 start = int(year1) for i in range((int(year2) - int(year1)) * 2): times.append('{start}-{end}-{term}'.format(start=start, end=start + 1,