#! / usr / bin / python
# - * - CODING: CP936 - * -
#############################################################
# Written by caocao # #
# caocao@eastday.com # #
# http://nethermit.yeah.net #
#############################################################
Import sys
IMPORT RE
IMPORT STRING
Print "Written by Caocao"
Print "caocao@eastday.com"
Print "http://nethermit.yeah.net"
Print
if len (sys.argv)! = 2:
Print "Usage: Python Ren.ape.py FilePath"
Sys.exit (1)
TRY:
fp = Open (sys.argv [1])
Except Ioerror:
Print "Can't load file from" sys.argv [1] "/ NPLEASE MAKE SURE THIS file exists."
Sys.exit (1)
ContentList = fp.readlines ()
fp.close ()
i = 1
For ContentLine In ContentList:
MatchObject = Re.Search ("^ Title * /" (. ) / "$", ContentLine, Re.I)
if MatchObject! = None:
IF i <10:
Rownum = "0% D"% i
Else:
Rownum = "% D"% i
i = 1
Print "REN" ROWNUM ". APE" ROWNUM "." String.Replace (MatchObject.group (1), "," ") ". APE "