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

split string in multiple lines

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

PV_drivers_version::
(xenvbd 1.0boot)
(xennet 4.0)
(major 5)
like thiz
thanks in advance.......
Jul 6 '12 #1
Share this Question
Share on Google+
4 Replies


ariful alam
100+
P: 185
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_version::;((xenvbd 1.0boot); (xennet 4.0); (major 5); (minor 6);
Jul 7 '12 #2

P: 5
ya excatly....my string was like vat u said....
nd i want the o/p as
PV_drivers_version::
(xenvbd 1.0boot)
(xennet 4.0)
(major 5)
Jul 9 '12 #3

P: 5
this is the string
Expand|Select|Wrap|Line Numbers
  1. 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 :
Expand|Select|Wrap|Line Numbers
  1. row ref =
  2. uuid =
  3. PV drivers =
  4. (xenvbd 1.0boot)
  5. (xennet 4.0)
  6. (major 5)
like tat
plz help me
Jul 9 '12 #4

ariful alam
100+
P: 185
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. :)
Jul 9 '12 #5

Post your reply

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