[python-users] Scherzfrage
do_not_reply_to_this_address at t-online.de
do_not_reply_to_this_address at t-online.de
Mi Mai 2 12:21:45 CEST 2012
In welchem Programmierparadigma programmiert dieser Programmierer
üblicherweise.
import shutil
import os.path
import sys
if len(sys.argv)!=2:
raise Exception("There has to be excatly on command line argument")
myfiles=
[("../tmp/body.tex","tex"),("../tmp/text.big","wiki"),("../tmp/url","url")]
myfiles= [(x[0],"../test/"+sys.argv[1]+"."+sys.argv[1]) for x in myfiles]
def mycheck(f,s,p):
if not p(os.path.exists(f)):
raise Exception(s % f)
for f in myfiles:
mycheck(f[0],"Could not read %s",lambda x: x)
mycheck(f[1],"%s allready Exists",lambda x: not x)
for f in myfiles:
shutil.copy(f[0], f[1])
Mehr Informationen über die Mailingliste python-users