Skip to content
Sign upLog in
← Back to Community

I accidently stumbled on a quine.

Profile icon
darkdarcoolHacker

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?

Voters
Profile icon
AlphaReturns2
Profile icon
JWZ6
Profile icon
darkdarcool
Comments
hotnewtop
Profile icon
Michael8910

pretty cool. but what could be of its use

Profile icon
darkdarcool

@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.

Profile icon
Michael8910

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

Profile icon
darkdarcool

@MikeJMS8910

good, it's a super interesting video.