def read_question(f): time.sleep(1) response = json.load(f) f.close() os.remove('question-zh.hortor.net/question/bat/findQuiz') question = response['data']['quiz'] options = response['data']['options'] sql_result=sql.sql_match_result('"%s"' % question) if sql_result: print('绝对正确答案: %s ' % sql_result) else: count_base(question, options) return response
def read_question(f): time.sleep(1) response = json.load(f) f.close() os.remove('question-zh.hortor.net/question/bat/findQuiz') question = response['data']['quiz'] options = response['data']['options'] sql_result = sql.sql_match_result('"%s"' % question) if sql_result: print('绝对正确答案: %s ' % sql_result) else: count_base(question, options) return response
def read_question(f): time.sleep(1) response = json.load(f) f.close() os.remove('question-zh.hortor.net/question/bat/findQuiz') question = response['data']['quiz'] options = response['data']['options'] sql_result = sql.sql_match_result('"%s"' % question) if sql_result: print('\nQuestion: ' + question) print('绝对正确答案:%s' % sql_result) while not os.path.exists('question-zh.hortor.net/question/bat/choose'): time.sleep(0.5) adbshell.tap('option' + str(options.index(sql_result))) else: count_base(question, options) return response
def read_question(f): time.sleep(1) response = json.load(f) f.close() os.remove('question-zh.hortor.net/question/bat/findQuiz') question = response['data']['quiz'] options = response['data']['options'] sql_result=sql.sql_match_result('"%s"' % question) if sql_result: print('Question: '+question) print('绝对正确答案:%s' % sql_result) while not os.path.exists('question-zh.hortor.net/question/bat/choose'): time.sleep(0.5) adbshell.tap('option' + str(options.index(sql_result))) else: count_base(question, options) return response
def get_question(findQuiz): time.sleep(1) response = json.load(findQuiz) findQuiz.close() os.remove('question.hortor.net/question/bat/findQuiz') question = response['data']['quiz'] options = response['data']['options'] print(question) hit_result = sql.sql_match_result('"%s"' % question) if hit_result: print('正确答案是: %s ' % hit_result) correct_index = options.index(hit_result) sleep_time = 4 tap.choose(correct_index,sleep_time) else: search_question(question, options) return response