Share your repls and programming experiences

← Back to all posts
I accidently stumbled on a quine.
darkdarcool (100)

Hi!

So, while I was just messing around in python, I stumbled upon something that I actually kind hard to do. Which is make a quine.
I'll quickly sum up what a quine is. It is bassicly making a coding language print it's own source code. And is a lot harder than it sounds(seriously try one).

So, think it's kinda funny that I accidentally stumbled on one.

Here is the code

from sys import *
def open_file(filename):
  data = open(filename, "r").read()
  print(data)
def run():
  data = open_file(argv[0])
run()

I put the repl under this, but you can copy paste the code above for yourself.

So, yeh. Short post. So uh. Bye?

Comments
hotnewtop
MikeJMS8910 (114)

pretty cool. but what could be of its use

darkdarcool (100)

@MikeJMS8910
nothing, its useless, watch the art of code on youtube, they explain it better and show you more things you can do with it(everything is useless though), but you may learn something you didn't know before.

MikeJMS8910 (114)

@darkdarcool oh yea I was actually just starting to watch it

darkdarcool (100)

@MikeJMS8910
good, it's a super interesting video.