D
dudeja.rajat
Hi,
I've a list some of whose elements with character \.
I want to delete this last character from the elements that have this
character set at their end,
I have written a small program, unfortunately this does not work:
dirListFinal = []
for item in dirList:
print item
if item.endswith('\\') == True:
item = item[0:-1] # This one I googled and
found to remove the last character /
dirListFinal.append(item)
else:
dirListFinal.append(item)
item.endswith() does not seem to be working.
Please help
I've a list some of whose elements with character \.
I want to delete this last character from the elements that have this
character set at their end,
I have written a small program, unfortunately this does not work:
dirListFinal = []
for item in dirList:
print item
if item.endswith('\\') == True:
item = item[0:-1] # This one I googled and
found to remove the last character /
dirListFinal.append(item)
else:
dirListFinal.append(item)
item.endswith() does not seem to be working.
Please help