Share your repls and programming experiences

← Back to all posts
Working Terminal like thing!
Viper2211 (54)

I just used the exec function and the eval function to create what seems like a real python terminal!

Commentshotnewtop
LizFoster (592)

Wow! Nice work! This is pretty cool. ^ ^*

nt998302 (159)

I did this too at one point in time! It's fun making these. Maybe make your own OS?

AmazingMech2418 (655)

@nt998302 You can get a bash command line in this by typing "from os import system" and "system('sh')". You can also convert the Python command line into bash by using "from os import system as exec". If in the bash command line, you can also run the actual python shell by typing "python".

nt998302 (159)

@AmazingMech2418 Sweet. Don't know much about system, but I know about exec. I usually just develop games xD

Highwayman (1289)

What’s the difference between exec and eval? I’ve never seen exec before I think.

[deleted]

@Highwayman the exec() function executes a string or code object as python code. eval() essentially does the same thing, but runs the code within the program.

More Information:
eval(): https://www.programiz.com/python-programming/methods/built-in/eval
exec(): https://www.programiz.com/python-programming/methods/built-in/exec