How to convert markup text to plain text in python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • muralimunna
    New Member
    • Jul 2012
    • 5

    How to convert markup text to plain text in python

    i had string like thiz:

    PV_drivers_up_t o_date::true
    ('name' 'Microsoft Windows Server 2008 R2 Standard |C:\\Windows|\\ Device\\Harddis k0\\Partition2' 'distro' 'windows''major ' '6''minor' '1''spmajor' '1''spminor' '0'
    i want to print without '',\\ and :

    please help me.
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    Use str replace method to replace unwanted characters with another such as a space or empty ("").
    Code:
    >>> print "'distro' 'windows''major' '6''minor'".replace("'", "")
    distro windowsmajor 6minor
    >>>

    Comment

    • muralimunna
      New Member
      • Jul 2012
      • 5

      #3
      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

      Comment

      Working...