Share your repls and programming experiences

← Back to all posts
Private repl without hacker plan(only python3)
kurrycat2004 (10)

As some of you may know, it is possible to save something like api keys in a .env file in a repl so only the owner of the repl can see it. There is also a function in Python that allows you to execute code saved as a string: exec().
Now i asked myself if it would be possible to save code in a .env and then execute it with exec(). It worked... kind of. Something like print('Hello World') did work and its also possible in python to write 2 or more lines in one line separated by a ";". But i couldnt figure out how to make functions... And then i asked myself if it would work to write a new line as \n. And it worked. After that i made a [website}(https://1liner--kurrycat2004.repl.co) that converts a normal python (all the code has to be in main.py) script into in line that can be pasted into a .env like that: script="PASTE LINE HERE". To run that code simply write that in your main.py: import os;exec(os.environ.get("script"))

Have fun not understanding your code, cause it is in one line. Bye

Discord Bot made with one visible line of code: