RickyBlender, using a capable text editor (e.g. NoteTab Light), you should be able to do an “Search and Replace” on the DATA prefix on each line, so that this…
DATA 0.25 , .8 , 78 , 76 , .25 , .219 , .331
DATA 0.33 , .8 , 78 , 76 , .328 , .289 , .437
DATA 0.5 , .8 , 78 , 76 , .49 , .39 , .62
DATA 0.75, 1.1 , 78 , 76 , .73 , .59 , .94
becomes this (being sure to disregard the “quote” in the top-left of these quoted text bubbles):
newArray.extend([0.25 , .8 , 78 , 76 , .25 , .219 , .331])
newArray.extend([0.33 , .8 , 78 , 76 , .328 , .289 , .437])
newArray.extend([0.5 , .8 , 78 , 76 , .49 , .39 , .62])
newArray.extend([0.75, 1.1 , 78 , 76 , .73 , .59 , .94])
…also adding a ]) at the end of each line.
To do this in NoteTab Light, paste your code into a new Python code text file (so as to keep your original BASIC code safe), and then bring up the Search / Replace window.
Click in the Find what box and type DATA and include one space after the last A in DATA.
Next, click in the Replace with box and type newArray.extend([
After that, click Replace All.
Once this is done, place the cursor at the top of the text file and bring up the Search / Replace window again.
In the Find what box, type ^P
– the ^ character being a shift 6 on a standard computer keyboard.
In the Replace with box type ])^P
After that, click Replace All.
At the very beginning of the new Python code text file, type this line:
newArray =
The new Python code text file should resemble something like this:
newArray =
newArray.extend([0.25 , .8 , 78 , 76 , .25 , .219 , .331])
newArray.extend([0.33 , .8 , 78 , 76 , .328 , .289 , .437])
newArray.extend([0.5 , .8 , 78 , 76 , .49 , .39 , .62])
newArray.extend([0.75, 1.1 , 78 , 76 , .73 , .59 , .94])
…and you can test-print your newly created Python list / array by adding these lines to the end of this new Python code text file:
print (newArray)
for n in newArray:print(n)
[Technical note: please be sure the print(n) line is indented once (one tab in) in the actual Python text file, as the forum spacing / indentation does not appear to carry over properly when copying / pasting this example.]
So, to summarize, this is what the search/replaced original code should look like with the additional printout code included at the end:
newArray =
newArray.extend([0.25 , .8 , 78 , 76 , .25 , .219 , .331])
newArray.extend([0.33 , .8 , 78 , 76 , .328 , .289 , .437])
newArray.extend([0.5 , .8 , 78 , 76 , .49 , .39 , .62])
newArray.extend([0.75, 1.1 , 78 , 76 , .73 , .59 , .94])
print (newArray)
for n in newArray:print(n)
I hope this possible method proves to be helpful to you =)
Best of luck with your project.
RobertT