Remove a character from a string in Python

>>> t=raw_input('Enter a text: ')
Enter a text: Hello
>>> lst=list(t)
>>> lst
['H', 'e', 'l', 'l', 'o']
>>> del l[2] #remove one l character
>>> lst
['H', 'e', 'l', 'o']
>>> t=''.join(lst)
>>> t
'Helo'
>>>

Posted by: lem | post date: 12-16-2012 | Subject: Python Programming Language

Comments

Name:
Comment:
Anti-spam text:

....................................................................................................................Home | Forum | About | Contact
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.
Copyright @ 2011-2013 worldbestlearningcenter. All Rights Reserved.
Home Programming Web DB & App Questions Exercises Tips Programs FAQs Download About
Computer-Wbest
Programming Tips
Related Posts