QUESTION DEFINITIONS
var P1_1 = new Array("P1_1", "An audit charter should:", "A. be dynamic and change often to

coincide with the changing nature of technology and the audit profession.", "B. clearly

state audit objectives for the delegation of authority for the maintenance and review of

internal controls.", "C. document the audit procedures designed to achieve the planned audit

objectives.", "D. outline the overall authority, scope and responsibilities of the audit

function.", "An audit charter should state management's objectives for, and delegation of

authority to, IS audit. This charter should not significantly change over time and should be

approved at the highest level of management. The audit charter would not be at a detail

level and therefore would not include specific audit objectives or procedures.", 4, 1);

i have to split like

An audit charter should:

A. be dynamic and change often tocoincide with the changing nature of technology and the audit profession.

B.clearlystate audit objectives for the delegation of authority for themaintenance and review of internal controls.

please help me to do like that

What you've shown is an array (list), that is, it's already split. What are you starting with?

no actually its like this

QUESTION DEFINITIONS
var P1_1 = new Array("P1_1", "An audit charter should:", "A. be dynamic and change often to

coincide with the changing nature of technology and the audit profession.", "B. clearly

state audit objectives for the delegation of authority for the maintenance and review of

internal controls.", "C. document the audit procedures designed to achieve the planned audit

objectives.", "D. outline the overall authority, scope and responsibilities of the audit

function.", "An audit charter should state management's objectives for, and delegation of

authority to, IS audit. This charter should not significantly change over time and should be

approved at the highest level of management. The audit charter would not be at a detail

level and therefore would not include specific audit objectives or procedures.", 4, 1);

**
and i have to split like this i am very new in this plz help me**

An audit charter should:

A. be dynamic and change often tocoincide with the changing nature of technology and the audit profession.

B.clearlystate audit objectives for the delegation of authority for themaintenance and review of internal controls.

please help me to do like that

hi its not code its text file that i need to slipt using python code..

So it seems that "QUESTION DEFINITIONS
var P1_1 = new Array...
level and therefore would not include specific audit objectives or procedures.", 4, 1);" is a string that does indeed look like a javascript array assignment. Let's say you've read that string into a python variable, strA. First, let's get rid of the stuff outside the parentheses:
strA=strA.split("(")[1].split(")")[0]
Now let's replace the commas with linefeeds:
strA=strA.replace(",","\n")
Now I think you have what you want, no?

hi thx to reply i am very new in phyton so i am not able to get actually what ur telling so plz explan how to do this

thx for ur help

Let's say your string, QUESTION DEFINITIONS
var P1_1 = new Array("P1_1", "An audit charter should:", "A. be dynamic and change often to coincide with the changing nature of technology and the audit profession.", "B. clearly state audit objectives for the delegation of authority for the maintenance and review of internal controls.", "C. document the audit procedures designed to achieve the planned audit objectives.", "D. outline the overall authority, scope and responsibilities of the audit function.", "An audit charter should state management's objectives for, and delegation of authority to, IS audit. This charter should not significantly change over time and should be approved at the highest level of management. The audit charter would not be at a detail level and therefore would not include specific audit objectives or procedures.", 4, 1);
, is in a file called "text.txt" (it could be anything).
Run this code:

fid=open("text.txt","r")
strA=fid.read()
fid.close()
strA=strA.split("(")[1].split(")")[0]
strA=strA.replace(",","\n")
print strA

What do you get?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.