June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,2 +1,2 @@
|
|||
x = 'x = %r\nprint(x %% x)'
|
||||
print(x % x)
|
||||
w = "print('w = ' + chr(34) + w + chr(34) + chr(10) + w)"
|
||||
print('w = ' + chr(34) + w + chr(34) + chr(10) + w)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
a = 'YSA9ICcnCmIgPSBhLmRlY29kZSgnYmFzZTY0JykKcHJpbnQgYls6NV0rYStiWzU6XQ=='
|
||||
b = a.decode('base64')
|
||||
print b[:5]+a+b[5:]
|
||||
x = """x = {0}{1}{0}
|
||||
print x.format(chr(34)*3,x)"""
|
||||
print x.format(chr(34)*3,x)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
data = (
|
||||
'ZGF0YSA9ICgKCSc=',
|
||||
'JywKCSc=',
|
||||
'JwopCnByZWZpeCwgc2VwYXJhdG9yLCBzdWZmaXggPSAoZC5kZWNvZGUoJ2Jhc2U2NCcpIGZvciBkIGluIGRhdGEpCnByaW50IHByZWZpeCArIGRhdGFbMF0gKyBzZXBhcmF0b3IgKyBkYXRhWzFdICsgc2VwYXJhdG9yICsgZGF0YVsyXSArIHN1ZmZpeA=='
|
||||
)
|
||||
prefix, separator, suffix = (d.decode('base64') for d in data)
|
||||
print prefix + data[0] + separator + data[1] + separator + data[2] + suffix
|
||||
a = 'YSA9ICcnCmIgPSBhLmRlY29kZSgnYmFzZTY0JykKcHJpbnQgYls6NV0rYStiWzU6XQ=='
|
||||
b = a.decode('base64')
|
||||
print b[:5]+a+b[5:]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
def applyToOwnSourceCode(functionBody):
|
||||
print "def applyToOwnSourceCode(functionBody):"
|
||||
print functionBody
|
||||
print "applyToOwnSourceCode(" + repr(functionBody) + ")"
|
||||
applyToOwnSourceCode('\tprint "def applyToOwnSourceCode(functionBody):"\n\tprint functionBody\n\tprint "applyToOwnSourceCode(" + repr(functionBody) + ")"')
|
||||
data = (
|
||||
'ZGF0YSA9ICgKCSc=',
|
||||
'JywKCSc=',
|
||||
'JwopCnByZWZpeCwgc2VwYXJhdG9yLCBzdWZmaXggPSAoZC5kZWNvZGUoJ2Jhc2U2NCcpIGZvciBkIGluIGRhdGEpCnByaW50IHByZWZpeCArIGRhdGFbMF0gKyBzZXBhcmF0b3IgKyBkYXRhWzFdICsgc2VwYXJhdG9yICsgZGF0YVsyXSArIHN1ZmZpeA=='
|
||||
)
|
||||
prefix, separator, suffix = (d.decode('base64') for d in data)
|
||||
print prefix + data[0] + separator + data[1] + separator + data[2] + suffix
|
||||
|
|
|
|||
5
Task/Quine/Python/quine-13.py
Normal file
5
Task/Quine/Python/quine-13.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def applyToOwnSourceCode(functionBody):
|
||||
print "def applyToOwnSourceCode(functionBody):"
|
||||
print functionBody
|
||||
print "applyToOwnSourceCode(" + repr(functionBody) + ")"
|
||||
applyToOwnSourceCode('\tprint "def applyToOwnSourceCode(functionBody):"\n\tprint functionBody\n\tprint "applyToOwnSourceCode(" + repr(functionBody) + ")"')
|
||||
|
|
@ -1 +1,2 @@
|
|||
x = 'x = {!r};print(x.format(x))';print(x.format(x))
|
||||
x = 'x = %r\nprint(x %% x)'
|
||||
print(x % x)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
import sys; sys.stdout.write(open(sys.argv[0]).read())
|
||||
x = 'x = {!r};print(x.format(x))';print(x.format(x))
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
import sys,inspect;sys.stdout.write(inspect.getsource(inspect.currentframe()))
|
||||
import sys; sys.stdout.write(open(sys.argv[0]).read())
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
print(__file__[:-3])
|
||||
import sys,inspect;sys.stdout.write(inspect.getsource(inspect.currentframe()))
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
$ python print\(__file__\[\:-3\]\).py
|
||||
print(__file__[:-3])
|
||||
|
|
|
|||
|
|
@ -1,4 +1,2 @@
|
|||
$ cat print\(__file__\)
|
||||
print(__file__)
|
||||
$ python print\(__file__\)
|
||||
print(__file__)
|
||||
$ python print\(__file__\[\:-3\]\).py
|
||||
print(__file__[:-3])
|
||||
|
|
|
|||
|
|
@ -1,11 +1,4 @@
|
|||
$ cat reproducing.py
|
||||
File "reproducing.py", line 1
|
||||
File "reproducing.py", line 1
|
||||
^
|
||||
IndentationError: unexpected indent
|
||||
|
||||
$ python reproducing.py
|
||||
File "reproducing.py", line 1
|
||||
File "reproducing.py", line 1
|
||||
^
|
||||
IndentationError: unexpected indent
|
||||
$ cat print\(__file__\)
|
||||
print(__file__)
|
||||
$ python print\(__file__\)
|
||||
print(__file__)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,11 @@
|
|||
x = """x = {0}{1}{0}
|
||||
print x.format(chr(34)*3,x)"""
|
||||
print x.format(chr(34)*3,x)
|
||||
$ cat reproducing.py
|
||||
File "reproducing.py", line 1
|
||||
File "reproducing.py", line 1
|
||||
^
|
||||
IndentationError: unexpected indent
|
||||
|
||||
$ python reproducing.py
|
||||
File "reproducing.py", line 1
|
||||
File "reproducing.py", line 1
|
||||
^
|
||||
IndentationError: unexpected indent
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue