[python-win32] sort error

Larry Bates larry.bates at websafe.com
Mon Jul 21 20:02:53 CEST 2008


kNish wrote:
> Hi, I have had this issue for long now. Is it possible to have a work 
> around for this. When these commands are run singly, they give a result. 
> When run inside a script, the second line does not give a result. What 
> is a possible work around for this. BkFiles.sort(key=str.upper) 
> last_bk_File_Name = BkFiles[len(BkFiles)-1] BRgds, kNish
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32

It is a little hard to read your code but I'll try:

Your code:
BkFiles.sort(key=str.upper)
last_bk_File_Name = BkFiles[len(BkFiles)-1]

# BRgds, kNish
#
# Not clear what this is supposed to do????
# This line should cause a syntax error.

You can more easily write the second line as:

last_bk_File_Name = BkFiles[-1]

-Larry





More information about the python-win32 mailing list