tags:

views:

115

answers:

2
def start(fileName):
  fileReader = open(fileName)
  for row in fileReader:
    print row,

if __name__ == "__main__":
  import sys
  if len(sys.argv) <= 1:
    print "usage quine /path/to/file"
    sys.exit(-1)
  fileName = sys.argv[0]
  start(fileName)

python quine.py foo

+2  A: 

Quines can't access the filesystem, so no. As Wikipedia states, "Allowing input would permit the source code to be fed to the program via the keyboard, opening the source file of the program, and similar mechanisms.".

Reference: Wikipedia: Quine (computing)

Ink-Jet
+7  A: 

No, a quine shouldn't take in any input:

A quine takes no input. Allowing input would permit the source code to be fed to the program via the keyboard, opening the source file of the program, and similar mechanisms.

From Quine (computing).

UPDATE

You need to encode the source into the quine itself. A quine consists of two parts: code that does the actual printing and data that represents the source code. It seems recursive, but isn't really. For a good quine tutorial, I recommend checking out this link; it's what I used to create a quine in a language that I designed.

Vivin Paliath
Thanks, I won a bet :-) (Some people don't trust wikipedia)
fsm