import time def katt(d): date0 = d.split("_")[0] if date0 == "cyear": return int(time.strftime("%Y")) else: return int(date0)
print katt("cyear_11_05") print katt("1984_11_05") l0nwlf-Arena:l0nwlf$ python katt.py 2009 1984 http://codepad.org/RBjKmNcA Hope this helps !
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor