import subprocess # Save the raw text input first so we don't lose what was typed user_input = input("Input your Command my master: ") try: n = int(user_input) print("Integer") except ValueError: # Safely escape single quotes if the user typed any safe_input = user_input.replace("'", "'\\''") # Pass the user's exact text directly into cowsay command = f"cowsay '{safe_input}' | lolcat -a -d 50" subprocess.run(command, shell=True)