How to use 'repl it python' in Python

Every line of 'repl it python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
24def repl(env=None):
25 """Start the interactive Read-Eval-Print-Loop"""
26
27 eof = "^Z" if sys.platform[0:3] == 'win' else "^D"
28
29 print("")
30 print(" " + faded(" \`. T "))
31 print(" Welcome to " + faded(" .--------------.___________) \ | T "))
32 print(" the DIY Lang " + faded(" |//////////////|___________[ ] ! T | "))
33 print(" REPL " + faded(" `--------------' ) ( | ! "))
34 print(" " + faded(" '-' ! "))
35 print(faded(" use " + eof + " to exit"))
36 print("")
37
38 if env is None:
39 env = Environment()
40
41 while True:
42 try:
43 source = read_expression()
44 print(interpret(source, env))
45 except DiyLangError as e:
46 print(colored("!", "red"))
47 print(faded(str(e.__class__.__name__) + ":"))
48 print(str(e))
49 except KeyboardInterrupt:
50 msg = "Interrupted. " + faded("(Use " + eof + " to exit)")
51 print("\n" + colored("! ", "red") + msg)
52 except EOFError:
53 print(faded("\nBye! o/"))
54 sys.exit(0)
55 except Exception as e:
56 print(colored("! ", "red") +
57 faded("The Python is showing through…"))
58 print(faded(" " + str(e.__class__.__name__) + ":"))
59 print(str(e))

Related snippets