Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How to delete a ast character from a string?

Reply
Thread Tools

How to delete a ast character from a string?

 
 
dudeja.rajat@gmail.com
Guest
Posts: n/a
 
      08-29-2008
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
--
Regrads,
Rajat
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
for-statement in AST hlwangz Java 1 04-26-2006 08:24 PM
for-statement representation in AST hlwangz Java 0 04-26-2006 03:20 AM
Python AST as XML Oleg Paraschenko XML 4 11-04-2004 10:58 AM
cookies between ast and asp.net Arno Seitinger ASP .Net 2 10-28-2004 09:03 AM



Advertisments