import os vopros = str(input('1: no logo\n2: Yes logo\nNumber:')) if vopros == '1': baran = str(input('Name .py file (.py -> .exe): ')) os.system(f'pyinstaller -F {baran}.py') print('Your .exe file -> dist \n by @matliteoff') elif vopros == '2': baran = str(input('Name .py file (.py -> .exe): ')) logo = str(input('Name .ico file: ')) os.system(f'pyinstaller -F -w -i {logo}.ico {baran}.py') print('Your .exe file -> dist \n by @matliteoff') Python import os vopros = str(input('1: no logo\n2: Yes logo\nNumber:')) if vopros == '1': baran = str(input('Name .py file (.py -> .exe): ')) os.system(f'pyinstaller -F {baran}.py') print('Your .exe file -> dist \n by @matliteoff') elif vopros == '2': baran = str(input('Name .py file (.py -> .exe): ')) logo = str(input('Name .ico file: ')) os.system(f'pyinstaller -F -w -i {logo}.ico {baran}.py') print('Your .exe file -> dist \n by @matliteoff') Код простой, сделал для облегчения вам
review: import os def main(): logo_choice = get_logo_choice() py_file = get_py_file_name() if logo_choice == '1': create_exe(py_file) elif logo_choice == '2': icon_file = get_icon_file_name() create_exe_with_logo(py_file, icon_file) def get_logo_choice(): while True: logo_choice = input('1: no logo\n2: Yes logo\nNumber:') if logo_choice in ['1', '2']: return logo_choice print('Please enter 1 or 2.') def get_py_file_name(): while True: py_file = input('Name .py file (.py -> .exe): ') if py_file.endswith('.py'): return py_file[:-3] print('Please enter a .py file.') def get_icon_file_name(): while True: icon_file = input('Name .ico file: ') if icon_file.endswith('.ico'): return icon_file[:-4] print('Please enter an .ico file.') def create_exe(py_file): os.system(f'pyinstaller -F {py_file}.py') print('Your .exe file -> dist\nby @matliteoff') def create_exe_with_logo(py_file, icon_file): os.system(f'pyinstaller -F -w -i {icon_file}.ico {py_file}.py') print('Your .exe file -> dist\nby @matliteoff') if __name__ == '__main__': main() Python import os def main(): logo_choice = get_logo_choice() py_file = get_py_file_name() if logo_choice == '1': create_exe(py_file) elif logo_choice == '2': icon_file = get_icon_file_name() create_exe_with_logo(py_file, icon_file) def get_logo_choice(): while True: logo_choice = input('1: no logo\n2: Yes logo\nNumber:') if logo_choice in ['1', '2']: return logo_choice print('Please enter 1 or 2.') def get_py_file_name(): while True: py_file = input('Name .py file (.py -> .exe): ') if py_file.endswith('.py'): return py_file[:-3] print('Please enter a .py file.') def get_icon_file_name(): while True: icon_file = input('Name .ico file: ') if icon_file.endswith('.ico'): return icon_file[:-4] print('Please enter an .ico file.') def create_exe(py_file): os.system(f'pyinstaller -F {py_file}.py') print('Your .exe file -> dist\nby @matliteoff') def create_exe_with_logo(py_file, icon_file): os.system(f'pyinstaller -F -w -i {icon_file}.ico {py_file}.py') print('Your .exe file -> dist\nby @matliteoff') if __name__ == '__main__': main()