def main(): docs = [] # 用于存放学生信息的空列表 while True: show_menu() s = input("请选择: ") if s == '1': docs += input_student() elif s == '2': output_student(docs) elif s == '3': print("开始删除") elif s == '4': print("开始修改成绩") elif s == '5': output_student_by_score_desc(docs) elif s == '6': output_student_by_score_asc(docs) elif s == '7': output_student_by_age_desc(docs) elif s == '8': output_student_by_age_asc(docs) elif s == '9': save_to_file(docs) # 保存到文件中 elif s == '10': docs = read_from_file() # 从文件中读取数据 elif s == 'q': break
def main(): L = read_from_file(filename='si.txt') while True: from menu import show_menu show_menu() s = input("请选择") if s == 'q': break elif s == '1': L += input_student() elif s == '2': output_student(L) elif s == '3': del_student(L) elif s == '4': alter_student(L) elif s == '5': s = score_high_student(L) output_student(s) elif s == '6': s = score_di_student(L) output_student(s) elif s == '7': s = age_high_student(L) output_student(s) elif s == '8': s = age_di_student(L) output_student(s) elif s == '9': save_to_file(L) elif s == '10': L = read_from_file()
def main(): L = [] while True: show_menu() # 此处先显示菜单 s = input("请选择: ") if s == 'q': break elif s == '1': L += input_student() elif s == '2': output_student(L) elif s == '3': delete_student(L) elif s == '4': check_student(L) elif s == '5': amend_student(L) elif s == '6': output_student_by_score_desc(L) elif s == '7': output_student_by_score_asc(L) elif s == '8': output_student_by_age_desc(L) elif s == '9': output_student_by_age_asc(L) elif s == 'h': save_to_file(L) elif s == 'r': L = read_from_file()
def main(): docs = [] #此列表用来存储所有学生的信息字典 while True: if __name__ == '__main__': show_menu() s = input("请选择:") if s == '1': docs += input_student() elif s == '2': output_student(docs) elif s == '3': modify_student_info(docs) elif s == '4': delete_student_info(docs) elif s == '5': get_score_rev(docs) elif s == '6': get_score(docs) elif s == '7': get_age_rev(docs) elif s == '8': get_age(docs) elif s == '9': save_to_file(docs) elif s == '10': pass elif s == 'q': return #结束此函数执行,直接退出
def main(): while True: show_menu() s = input('请选择') if s == '1': si.add_people_info() elif s == '2': si.show_people_info() elif s == '3': si.modify_people_score() elif s == '4': si.del_people_info() elif s == '5': si.order_by_score_desc() elif s == '6': si.order_by_score() elif s == '7': si.order_by_age_desc() elif s == '8': si.order_by_age() elif s == '9': si.save_to_txt() elif s == '10': si.read_from_txt() elif s == '11': si.save_to_csv() elif s == '12': si.read_from_csv() elif s == '13': si.save_to_mysql() elif s == 'q': break
def main(): #此列表用于保存学生数据 infos = [] while 1: menu.show_menu() s = input("请选择:") if s == "1": infos += si.input_student() elif s == "2": si.output_student(infos) elif s == "3": si.del_stu(infos) elif s == "4": si.modify_stu(infos) elif s == "5": si.student_score_sort_h_l(infos) elif s == "6": si.student_score_sort_l_h(infos) elif s == "7": si.student_age_sort_h_l(infos) elif s == "8": si.student_age_sort_l_h(infos) elif s == "9": infos = si.stu_read() elif s == "10": si.save_to_file(infos) elif s == "q": break
def main(): if len(sys.argv) < 3: print('argv is error') return HOST = sys.argv[1] PORT = int(sys.argv[2]) ADDR = (HOST, PORT) #文件服务器地址/服务端地址 #创建套接字,跟服务端相同 sockfd = socket() try: sockfd.connect(ADDR) except: print('连接服务器失败') return ftp = FtpClient(sockfd) #功能类对象 while True: show_menu() cmd = input('请输入命令>>:') if not cmd: break elif cmd.strip() == '1': ftp.do_list() elif cmd.strip()[0] == '2': filename = cmd.split(' ')[-1] ftp.do_get(filename) elif cmd.strip()[0] == '3': filename = cmd.split(' ')[-1] ftp.do_upload(filename) elif cmd.strip()[0] == '4': sys.exit(0) else: print('请输入正确命令!!!') continue
def main(): students_list = student_info.read_info() while True: show_menu() s = input('请选择:') if s == '1': while True: s = student_info.add_students() if s == 'q': break students_list.append(s) elif s == '2': student_info.view_students(students_list) elif s == '3': student_info.del_students(students_list) elif s == '4': student_info.modify_student_score(students_list) elif s == '5': student_info.scores_high(students_list) elif s == '6': student_info.scores_low(students_list) elif s == '7': student_info.age_high(students_list) elif s == '8': student_info.age_low(students_list) elif s == '9': students_list = student_info.read_info() elif s == '10': student_info.save_info(students_list) elif s == 'q': break else: print('您选择错误,请重新输入!')
def main(): L = [] while True: show_menu() s = input('请选择:') if s == 'q': break elif s == '1': L += input_student_info() elif s == '2': output_student_info(L) elif s == '3': delete_student_info(L) elif s == '4': modify_student_score(L) elif s == '5': print_info_by_score_desc(L) elif s == '6': print_info_by_score_asc(L) elif s == '7': print_info_by_age_desc(L) elif s == '8': print_info_by_age_asc(L) elif s == '9': save_student_file(L) elif s == '10': L = read_student_info()
def main(): L = [] # 此列表储存学生信息# 创建一个列表,准备存放学生数据的字典 while True: show_menu() s = input("请输入你的操作") if s == '1': student_infof.add_information(L) elif s == '2': student_infof.output_student(L) elif s == '3': student_infof.delete_student(L) elif s == '4': student_infof.modify_score(L) elif s == '5': student_infof.scoresheng(L) elif s == '6': student_infof.scorejiang(L) elif s == '7': student_infof.agesheng(L) elif s == '8': student_infof.agejiang(L) elif s == '9': L.extend(student_infof.read_data()) elif s == '10': student_infof.save_data(L) elif s == 'q': break
def main(): docs = [] while True: show_menu() s = input("请输入选项>>") if s == '1': docs += input_student() elif s == '2': output_student(docs) elif s == '3': modify_student(docs) elif s == '4': delete_student(docs) elif s == '5': score_student_desc(docs) elif s == '6': score_student_asc(docs) elif s == '7': age_student_desc(docs) elif s == '8': age_student_asc(docs) elif s == '9': save_to_file(docs) elif s == '10': docs = read_from_file() elif s == 'q': return
def main(): docs = [] while True: show_menu() s = input('請選擇:') if s == "1": docs += input_student() elif s == "2": output_student(docs) elif s == "3": modify_student_info(docs) elif s == "4": delete_student_info(docs) elif s == '5': print_by_score_desc(docs) elif s == "6": print_by_score_asc(docs) elif s == '7': print_by_age_desc(docs) elif s == '8': print_by_age_asc(docs) elif s == "9": save_to_file(docs) elif s == "10": docs = read_from_file() elif s == 'q': return
def main(): infos = [] # 此列表用来保存学生信息的数据 while True: show_menu() s = input("请选择:") if s == '1': infos += input_student() print("添加成功") elif s == '2': output_student(infos) elif s == '3': delete_student(infos) # 删除信息 elif s == '4': modify_student_score(infos) # 修改成绩 elif s == '5': print("按学生成绩高-低显示学生信息") output_student_by_score_reduce(infos) elif s == '6': print("按学生成绩低-高显示学生信息") output_student_by_score_increase(infos) elif s == '7': print("按学生年龄高-低显示学生信息") output_student_by_age_reduce(infos) elif s == '8': print("按学生年龄低-高显示学生信息") output_student_by_age_increase(infos) elif s == '9': infos = read_from_file() # 从文件中读取数据 elif s == '10': save_to_file(infos) # 保存到文件 elif s == 'q': break
def main(): infos = [] #用于保存学生信息的列表 while True: # 打印菜单 show_menu() s = input('请选择:') if s == '1': infos += input_student() elif s == '2': print_student(infos) elif s == '3': remove_student(infos) elif s == '4': modify_score(infos) elif s == '5': print_score_desc(infos) elif s == '6': print_score_asc(infos) elif s == '7': print_age_desc(infos) elif s == '8': print_age_asc(infos) elif s == '9': infos = read_from_file() elif s == '10': save_to_file(infos) elif s == 'q': break
def main(): docs = [] # 此列表用来存储所有学生的信息的字典 while True: show_menu() s = input('请选择:') if s == '1': docs += input_student() elif s == '2': output_student(docs) elif s == '3': modify_student_info(docs) elif s == '4': delete_student_info(docs) elif s == '5': score_desc(docs) elif s == '6': score_asc(docs) elif s == '7': age_desc(docs) elif s == '8': age_asc(docs) elif s == '9': save_to_file(docs) elif s == '10': docs = read_from_file() elif s == 'q': return #结束此函数执行,直接退出
def main(): serial_port = SerialPort(select_port()) _thread.start_new_thread(read, (serial_port, )) while 1: menu.show_menu() command = input("Choose: ") menu.choose_menu(int(command), serial_port)
def main(): while True: show_menu() s = input("請選擇:") # 運行 crapy crawl cnyesSpider if s == '1': os.chdir('./Cnyes/Cnyes/spiders/') os.system('scrapy crawl cnyesSpider') os.chdir('../../..') # 運行 scrapy crawl taiwanindexSpider elif s == '2': os.chdir('./Taiwanindex/Taiwanindex/spiders/') os.system('scrapy crawl taiwanindexSpider') os.chdir('../../..') # 運行 python3 kdj.py elif s == '3': os.system('python3 kdj.py') # 運行 python3 ebb.py elif s == '4': os.system('python3 ebb.py') # 運行 python3 poly.py elif s == '5': os.system('python3 poly.py') # 結束執行,直接退出 elif s == 'q': return # 請重新輸入 else: print("請重新輸入")
def choose(): # 選擇 docs = [] # 此列表用來儲存所有學生訊息 while True: menu.show_menu() choose = str(input('選擇功能:')) if choose == '1': docs += input_stud() elif choose == '2': output_stud(docs) elif choose == '3': output_stud(docs) modify(docs) output_stud(docs) elif choose == '4': Del_Sort(docs) elif choose == '5': GradeSort_Big(docs) elif choose == '6': GradeSort_Samll(docs) elif choose == '7': AgeSort_Big(docs) elif choose == '8': AgeSort_Samll(docs) elif choose == '9': Save_Function(docs) elif choose == '10': flusho(filename='student.txt') elif choose == 'q': print('退出') break else: print('重新選擇')
def main(): infos = [] while True: show_menu() s = input("请选择: ") if s == '1': infos += input_student() elif s == '2': # 显示学生信息: output_student(infos) elif s == '3': remove_student(infos) elif s == '4': modify_student(infos) elif s == '5': output_student_by_score_desc(infos) # 降序 elif s == '6': output_student_by_score_asc(infos) # 升序 elif s == '7': output_student_by_age_desc(infos) # 降序 elif s == '8': output_student_by_age_asc(infos) # 升序 elif s == '9': infos = read_from_file() elif s == '10': save_to_file(infos) elif s == 'q': break
def main(): infos = [] # 用来保存信息的最重要的列表 while True: show_menu() s = input("请选择: ") if s == '1': infos += input_student() elif s == '2': output_student(infos) elif s == '3': # 删除学生信息 delete_student_info(infos) elif s == '4': # 修改学生成绩 modify_student_score(infos) elif s == '5': output_student_by_score_desc(infos) elif s == '6': output_student_by_score_asc(infos) elif s == '7': output_student_by_age_desc(infos) elif s == '8': output_student_by_age_asc(infos) elif s == '9': infos = read_from_file() elif s == '10': save_to_file(infos) elif s == 'q': break
def main(): L = [] while True: show_menu() _input = input('请输入命令') if _input == 'q': # 退出 break elif _input == '1': input_student(L) elif _input == '2': print_student(L) elif _input == '3': del_student(L) elif _input == '4': mod_student(L) elif _input == '5': score_h(L) elif _input == '6': score_l(L) elif _input == '7': age_h(L) elif _input == '8': age_l(L) elif _input == '9': L = read_from_file() elif _input == '10': save_to_file(L) else: print('命令输入错误')
def main(): L = [] while True: show_menu() s = input("请选择: ") if s == 'q': break elif s == '1': L += input_student() elif s == '2': output_student(L) elif s == '3': del_student(L) elif s == '4': modify_student_score(L) elif s == '5': print_info_by_score_Odesc(L) elif s == '6': print_info_by_score_asc(L) elif s == '7': print_info_by_age_desc(L) elif s == '8': print_info_by_age_asc(L) elif s == '9': store_stu_info(L) elif s == '10': read_stu_info(L)
def main(): # L = [] while True: show_menu() s = input("请选择: ") if s == 'q': break elif s == '1': L = input_student() # print(L) elif s == '2': output_student(L) elif s == '3': del_remove(L) elif s == '4': xiugai_student(L) # print(L) elif s == '5': score_low(L) elif s == '6': low_score(L) elif s == '7': age_low(L) elif s == '8': low_age(L) elif s == '9': baocun(L, si='si.txt') elif s == '10': L = duqu(si='si.txt')
def main(): infos = [] # 用于保存学生信息的列表 while True: # 打印菜单: show_menu() s = input('请选择: ') if s == '1': infos += input_student() elif s == '2': print_student(infos) elif s == '3': remove_student(infos) elif s == '4': modify_score(infos) elif s == '5': #5) 按学生成绩高-低显示学生信息 print_score_desc(infos) elif s == '6': #6) 按学生成绩低-高显示学生信息 print_score_asc(infos) elif s == '7': #7) 按学生年龄高-低显示学生信息 print_age_desc(infos) elif s == '8': #8) 按学生年龄低-高显示学生信息 print_age_asc(infos) elif s == 'q': break
def main(): infos = [] # 此列表用于保存学生数据 while True: show_menu() s = input("请选择: ") if s == '1': infos += input_student() elif s == '2': output_student(infos) elif s == '3': delete_student(infos) elif s == '4': modify_student_score(infos) elif s == '5': output_by_score_desc(infos) elif s == '6': output_by_score_asc(infos) elif s == '7': output_by_age_desc(infos) elif s == '8': output_by_age_asc(infos) elif s == '9': infos = read_from_file() elif s == '10': save_to_file(infos) # 保存 elif s == 'q': break
def main(): '''主函数,此函数最先运行''' infos = [] # 此列表用来保存所有学生的信息的字典 # 进入主事件循环 while True: show_menu() s = input("请选择: ") if s == 'q': return # 退出main函数 elif s == '1': infos += input_student() # infos.extend(input_student()) elif s == '2': output_student(infos) elif s == '3': remove_student(infos) elif s == '4': modify_student_score(infos) elif s == '5': output_student_by_score_desc(infos) elif s == '6': output_student_by_score_asc(infos) elif s == '7': output_student_by_age_desc(infos) elif s == '8': output_student_by_age_asc(infos) elif s == '9': infos = read_from_file() elif s == '10': save_to_file(infos)
def main(): docs = [] # 此列表用來存储所有學生的信息的字典 while True: show_menu() s = input("請選擇: ") if s == '1': docs += input_student() elif s == '2': output_student(docs) elif s == '3': # 修改學生成績 modify_student_info(docs) elif s == '4': # 刪除學生成績 delete_student_info(docs) elif s == '5': print_by_score_desc(docs) elif s == '6': print_by_score_asc(docs) elif s == '7': print_by_age_desc(docs) elif s == '8': print_by_age_asc(docs) elif s == '9': # 保存 save_to_file(docs) elif s == '10': # 讀取 docs = read_from_file() elif s == 'q': return # 結束此函數執行,直接退出
def main(): if len(sys.argv) < 3: print("argv is error") return HOST = sys.argv[1] PORT = int(sys.argv[2]) ADDR = (HOST, PORT) s = socket() try: s.connect(ADDR) except: print("连接服务器失败") return ftp = FtpClient(s) #功能类对象 while True: show_menu() cmd = input("请选择:") if not cmd: break elif cmd.strip() == '1': ftp.do_list() elif cmd.strip() == '2': ftp.do_get() elif cmd.strip() == '3': ftp.do_put() elif cmd.strip() == 'q': ftp.do_quit() s.close() sys.exit("谢谢使用")
def main(): infos = [] # 此列表用来保存学生信息的数据 while True: show_menu() s = input("请选择: ") if s == '1': infos += input_student() elif s == '2': output_student(infos) elif s == '3': delete_student(infos) # 删除学生 elif s == '4': modify_student_score(infos) # 修改学生成绩 elif s == '5': print_student_by_score_desc(infos) # desc降序 elif s == '6': print_student_by_score_asc(infos) # asc升序 elif s == '7': print_student_by_age_desc(infos) elif s == '8': print_student_by_age_asc(infos) elif s == '9': infos = read_from_file() # 从文件中读取数据 elif s == '10': save_to_file(infos) # 保存到文件 elif s == 'q': break
def main(): docs = [] # 此列表用来存储所有学生的信息的字典 while True: show_menu() s = input("请选择: ") if s == '1': docs += input_student() elif s == '2': output_student(docs) elif s == '3': # 修改学生成绩 modify_student_info(docs) elif s == '4': # 删除学生成绩 delete_student_info(docs) elif s == '5': print_by_score_desc(docs) elif s == '6': print_by_score_asc(docs) elif s == '7': print_by_age_desc(docs) elif s == '8': print_by_age_asc(docs) elif s == '9': # 保存 save_to_file(docs) elif s == '10': # 读取 docs = read_from_file() elif s == 'q': return # 结束此函数执行,直接退出
menu_sound = pygame.mixer.Sound("audio/menu.ogg") # Menu music menu_sound.play(-1) # screenwidth = 800 # screenheight = 600 # Testing purpose screenwidth = 1024 screenheight = 768 FPS = 20 # Set screen with width and height screen = pygame.display.set_mode((screenwidth, screenheight)) # Set title for the window and icon for the game pygame.display.set_caption("Treasure Hunter") iconImg = pygame.image.load("img/icon.png") pygame.display.set_icon(iconImg) # Start game menu and get user selections selections = show_menu(screen, FPS) ''' This is a menu selections example: {'game_music': False, 'play_game': True, 'game_sounds': True, 'unknown': False, 'show_credits': False, 'exit_game': False} ''' # Process user selections if selections['exit_game'] == True: pygame.quit() exit(0) elif selections['play_game'] == True: menu_sound.fadeout(1000) Game.start(screen, screenheight, screenwidth, FPS)
import render from generator import Generator import logging from player import Player from computer import Computer import menu from time import time, sleep import globals if __name__ == "__main__": logging.basicConfig(filename='rats.log', level=logging.INFO) if config.enable_menu: menu.show_menu() pygame.init() player = Player() generator = Generator(player) game = model.Model(generator) view = render.View(game.map.size) measure_time_period = 20 measure_time_phase = 0 speed = config.initial_speed running = True while running: if measure_time_phase == 0: total_time = 0.0 game_time = 0.0 measure_time_phase = (measure_time_phase + 1) % measure_time_period
#quick = cv2.imread('quick.png') while True: # Capture frame-by-frame ret, frame = cap.read() trigger = ser.readline(100) # Display the resulting frame frame = cv2.resize(frame, None, fx= scale_x, fy= scale_y, interpolation = cv2.INTER_AREA) cv2.imshow('Lindsey & Mark are Married!', frame) #turn the UI led on while photo-session is not in progress ser.write(str(1)) show_menu(0, False, True) if "Button" in trigger: start_time = time.time() numPics = 0 #turn the UI led off while photo-session is in progress ser.write(str(0)) #take the requested num pics in photobooth style while (numPics < pics_to_take): ret, frame = cap.read() frame = cv2.resize(frame, None, fx= scale_x, fy= scale_y, interpolation = cv2.INTER_AREA) cv2.imshow('Lindsey & Mark are Married!', frame) elapsed_time = time.time() - start_time show_menu(elapsed_time, False, False)