split string in multiple lines

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

    split string in multiple lines

    PV_drivers_vers ion::((xenvbd 1.0boot) (xennet 4.0) (major 5) (minor 6) (micro 100) (build 47101))
    i want o/p as:

    PV_drivers_vers ion::
    (xenvbd 1.0boot)
    (xennet 4.0)
    (major 5)
    like thiz
    thanks in advance.......
  • ariful alam
    New Member
    • Jan 2011
    • 185

    #2
    To split a string you need a common character that used to split the string like ',',':',';' etc. in yous string it may be like following:
    PV_drivers_vers ion::;((xenvbd 1.0boot); (xennet 4.0); (major 5); (minor 6);

    Comment

    • muralimunna
      New Member
      • Jul 2012
      • 5

      #3
      ya excatly....my string was like vat u said....
      nd i want the o/p as
      PV_drivers_vers ion::
      (xenvbd 1.0boot)
      (xennet 4.0)
      (major 5)

      Comment

      • muralimunna
        New Member
        • Jul 2012
        • 5

        #4
        this is the string
        Code:
        row ref="OpaqueRef:b0147930-b9aa-2d95-0b0a-52d589c7520d" last_updated="20120514T13:04:01Z" disks="()" other_config="()" uuid="74d06017-78ea-8dab-3ed7-457869aea112" other="(('platform-feature-multiprocessor-suspend' '1') ('feature-balloon' '1') ('balloon-active' '0') ('feature-suspend' '1') ('feature-shutdown' '1') ('feature-rexec' '1') ('feature-ts' '1'))" PV_drivers_up_to_date="true" PV_drivers_version="(('xenvbd' '1.0boot') ('xennet' '4.0') ('major' '5') ('minor' '6') ('micro' '100') ('build' '47101'))" os_version="(('name' 'Microsoft Windows Server 2008 R2 Standard |C:\\Windows|\\Device\\Harddisk0\\Partition2') ('distro' 'windows') ('major' '6') ('minor' '1') ('spmajor' '1') ('spminor' '0'))" networks="(('0/ip' '192.168.41.140'))" memory="()" live="true" _ref="OpaqueRef:b0147930-b9aa-2d95-0b0a-52d589c7520d" />
        hw can u print this as :
        Code:
        row ref =
        uuid =
        PV drivers =
        (xenvbd 1.0boot)
        (xennet 4.0)
        (major 5)
        like tat
        plz help me
        Last edited by bvdet; Jul 9 '12, 01:13 PM. Reason: Add code tags to make post more readable.

        Comment

        • ariful alam
          New Member
          • Jan 2011
          • 185

          #5
          See I am not a python coder, so I can't explain you how to split string in python. but it is true that to split a string you have to use split() function. here are some link on how to split a string:

          Split a string

          oreilly example

          hacksparrow example

          Hope these are help you. :)

          Comment

          Working...