kNish wrote:
The following lines of code gives an error starting with
line where len() is used
[... snip code for the moment ...]
META-ADVICE: kNish, when you're posting a question, please,
please, post post the traceback you got. Cut-and-paste it from
the console window into the email.
local_BkFiles = glob.glob(localDirectoryName+'\\*' +
data + '*bk*')
local_BkFiles.sort(key=str.upper)
last_pv_File_Name = local_PvFiles[len(local_PvFiles)-1]
split_last_pv_File_Name =
re.search(data+"_bk[0-9]{2}_[a-z]{3}_pv[0-9]{2}",last_pv_File_Name )
lastPv_FileVersion =
re.search('(?<=pv)\d+',split_last_pv_File_Name.group(0))
I'm not going to try to decode the re, but I can point out a few
things:
+ You might want to look into os.path.join for the glob line, altho'
what you've got seems all right.
+ To get the last item in a list L (or the last nth item) you can use
L[-1] (or L[-n]).
What problem are you trying to solve here?
TJG
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32