def up_info(): print(color.yellow("[*] 正在联网获取更新信息...(更新显示不会打断之前输入等操作)")) __INFO = "TechXueXi最新下载地址为 https://github.com/TechXueXi/TechXueXi" __SITE = "科技强国官方网站:https://techxuexi.js.org" # vercel_url = "https://techxuexi.vercel.app/Update.html" jsdelivery_url = "https://cdn.jsdelivr.net/gh/TechXueXi/TechXueXi@master/SourcePackages/pdlearn/version_info.json" try: native_info = get_native_json() remote_json = requests.get(jsdelivery_url).content.decode("utf8") remote_info = json.loads(remote_json) print(remote_info["notice"]) except: print(color.yellow("[*] 版本信息网络错误")) try: remote_least_version = int((str(remote_info["least_version"]))[1:]) int_native_version = int((str(native_info["techxuexi_version"]))[1:]) if int_native_version < remote_least_version: old_version_warning = remote_info["old_version_warning"] print(color.yellow("[*] 您的版本太低,程序不会继续运行。请升级:")) print(old_version_warning) while True: time.sleep(6000) except: print(color.yellow("[*] 查询本版本是否能继续使用,错误")) try: native_version = native_info["techxuexi_version"] native_update_logs = native_info["techxuexi_update_log"] remote_version = remote_info["techxuexi_version"] remote_update_logs = remote_info["techxuexi_update_log"] print(color.yellow("[*] " + __INFO)) print(color.yellow("[*] 程序版本为:{}".format(native_version))) print(color.yellow("[*] 最新版本为:{}".format(remote_version))) if remote_version > native_version: # 有新版本 print(color.red("[*] 当前不是最新版本,建议更新")) print(color.red("[*] " + "=" * 60)) print(color.red("[*] 更新提要:")) for log in remote_update_logs: if log["version"] > native_version: print(color.red("[*] " + log["version"])) print(color.red(log["info"])) else: print(color.yellow("[*] " + __INFO)) print(color.yellow("[*] " + __SITE)) break except: print(color.yellow("[*] 版本信息网络错误"))
def up_info(): print(color.yellow("[*] 正在联网获取更新信息...(更新显示不会打断之前输入等操作)")) __INFO = "TechXueXi最新下载地址为 https://github.com/TechXueXi/TechXueXi" __SITE = "科技强国官方网站:https://techxuexi.js.org" # vercel_url = "https://techxuexi.vercel.app/Update.html" jsdelivery_url = "https://cdn.jsdelivr.net/gh/TechXueXi/TechXueXi@master/SourcePackages/pdlearn/version_info.json" try: native_info = get_native_json() native_version = native_info["techxuexi_version"] native_update_logs = native_info["techxuexi_update_log"] remote_json = requests.get(jsdelivery_url).content.decode("utf8") remote_info = json.loads(remote_json) remote_version = remote_info["techxuexi_version"] remote_update_logs = remote_info["techxuexi_update_log"] print(color.yellow("[*] " + __INFO)) print(color.yellow("[*] 程序版本为:{}".format(native_version))) print(color.yellow("[*] 最新版本为:{}".format(remote_version))) if remote_version > native_version: # 有新版本 print(color.red("[*] 当前不是最新版本,建议更新")) print(color.red("[*] " + "=" * 60)) print(color.red("[*] 更新提要:")) for log in remote_update_logs: if log["version"] > native_version: print(color.red("[*] " + log["version"])) print(color.red(log["info"])) else: print(color.yellow("[*] " + __INFO)) print(color.yellow("[*] " + __SITE)) break except: print(color.yellow("[*] 版本信息网络错误"))
def up_info(): print(color.yellow("[*] 正在联网获取更新信息...(更新显示不会打断之前输入等操作)")) __Version = "v20200928" __INFO = "TechXueXi最新下载地址为 https://github.com/TechXueXi/TechXueXi" try: update_log = requests.get( "https://techxuexi.vercel.app/Update.html").content.decode("utf8") update_log = update_log.split("\n") print(color.yellow("[*] " + __INFO)) print(color.yellow("[*] 程序版本为:{}".format(__Version))) print(color.yellow("[*] 最新版本为:{}".format(update_log[1].split("=")[1]))) if __Version != update_log[1].split("=")[1]: print(color.red("[*] 当前不是最新版本,建议更新")) print(color.red("[*] =" * 60)) print(color.red("[*] 更新提要:")) for i in update_log[2:]: print(color.red("[*] " + i)) except: print(color.yellow("[*] 版本信息网络错误"))
'answer': r[1], 'datetime': r[2] }) ###################################将tikuNet表中的题库,插入到tiku表中############### # question = r[1] # answer = r[2] # db = DbTool() # q = db.query('select * from ' + 'tiku' + ' where question = "' + question + '" and answer = "' + answer + '"') # if not len(q): # result = db.execute('insert into ' + 'tiku' + '(question,answer) values (?,?)', (question, answer)) # print(result) ###################################将tikuNet表中的题库,插入到tiku表中############### # return json.dumps(data, ensure_ascii=False) return data if __name__ == '__main__': count = 0 while True: count = count + 1 question = input("开始第{}次挑战答题,请输入题目(输入`exit`退出答题):".format(count)) if question == 'exit': break data = search(keyword=question) print(color.yellow("共查询到{}条数据如下:".format(data['total']))) for i in range(len(data['rows'])): print("Question{}:{}\nAnswer:{}\n".format( i + 1, data['rows'][i]['question'], color.green(data['rows'][i]['answer'])))