By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,360 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,360 IT Pros & Developers. It's quick & easy.

How to convert markup text to plain text in python

P: 5
i had string like thiz:

('name' 'Microsoft Windows Server 2008 R2 Standard |C:\\Windows|\\Device\\Harddisk0\\Partition2''dist ro' 'windows''major' '6''minor' '1''spmajor' '1''spminor' '0'
i want to print without '',\\ and :

please help me.
Jul 4 '12 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 2.5K+
P: 2,851
Use str replace method to replace unwanted characters with another such as a space or empty ("").
Expand|Select|Wrap|Line Numbers
  1. >>> print "'distro' 'windows''major' '6''minor'".replace("'", "")
  2. distro windowsmajor 6minor
  3. >>> 
Jul 4 '12 #2

P: 5
thank fr giving solution....
can please help me how to get the entrie txt has plain txt
iwant output as:-
name Microsoft Windows Server 2008 R2 Standard C Windows Device Harddisk0 Partition2 dist ro windows major 6 minor 1 spmajor 1 spminor 0
Jul 5 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.