Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import os
- class Terminal:
- def __init__(self):
- pass
- def execute(self, command):
- command = command.split()
- if "cd" in command:
- os.chdir(command[1])
- return ""
- return subprocess.check_output(command).decode()
- print("Terminal Emulator")
- term = Terminal()
- while True:
- try:
- print(term.execute(input(f"{os.getcwd()}->")))
- except:
- print("Ошибка. Попробуйте далее")
- continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement