changing names of items in a list

royG roygeorget at gmail.com
Wed Mar 19 10:21:46 EDT 2008


hi
i am trying to rename extension of files in a directory..as an initial
step i made a method in

class ConvertFiles:
     def __init__(self,infldr,outfldr):
             self.infldr=infldr
             self.outfldr=outfldr
             self.origlist=os.listdir(infldr)
....
     def renamefiles(self,extn):
             for x in self.origlist:
                     x=x+"."+extn

...

later when i print self.origlist  i find that the elements of list are
unchanged..even tho  a print x  inside the renamefiles()  shows that
extn is appended to x  ..
why does this happen?
RG






More information about the Python-list mailing list