quinoid script

Ben Wolfson rumjuggler at home.com
Tue Jan 18 22:45:00 EST 2000


Got bored, wrote the below.  
It opens a file with the same name as itself but with an extra '1' before
the .py extension, then deletes the file that created it.
Just wanted to point out how easy it was to write.


-----------FILE STARTS HERE---------
import os, sys

s = """
import os, sys

s = %c%c%c%s%c%c%c
open((sys.argv[0][:-3]+'1'+sys.argv[0][-3:]),'w').write(s %%
(34,34,34,s,34,34,34))
try:
	os.remove((sys.argv[0][:-4]+sys.argv[0][-3:]))
except:
	pass
"""
open((sys.argv[0][:-3]+'1'+sys.argv[0][-3:]),'w').write(s %
(34,34,34,s,34,34,34))
try:
	os.remove((sys.argv[0][:-4]+sys.argv[0][-3:]))
except:
	pass

-- 
Barnabas T. Rumjuggler

Liberty is commonly thought of not as a constant, but as something which
must be made to expand indefinitely, lest it become boring.
 -- The Flummery Digest




More information about the Python-list mailing list