Velocity Reviews - Computer Hardware Reviews

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

Thread Tools

How to delete a ast character from a string?
Posts: n/a

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 /

item.endswith() does not seem to be working.

Please help
Reply With Quote

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 Arno Seitinger ASP .Net 2 10-28-2004 09:03 AM