Hi everyone,
Am having a hard time with figuring out this rather simple split. I
have python code (actual code) store in the database, with the
following table (f_codetest is the table, the result are three after):
'f_codetest': '>>> functionOne(1, 2)\r\nTrue\r\n>>> functionOne(2, 1)\r
\nFalse\r\n>>> functionOne(0, -1)\r\nFalse\r\n'
I grab the data as such:
{{for row in
db(db.t_problems.id==db.t_problems(request.args(0))).select(): }}
How do I loop through the functions to put functionOne(X, Y) in a
separate variable from True/False? I've gotten this far:
{{io = row.f_tests.split('>>>')}}
Which will remove the >>>, and the result is:
functionOne(1, 2)\r\nTrue\r\n functionOne(2, 1)\r\nFalse\r\n
functionOne(0, -1)\r\nFalse\r\n'
I tried doing:
{{ for io in ioList:
i = io.split("\r\n")}}
but that only removes the "\r\n". Am trying to put functionOne(X,Y) in
it's own td and True/False right next to it, so:
<table><tr><td>functionOne(X,Y)</td><td>True</td></tr>
<tr><td>functionOne(X,Y)</td><td>False</td></tr></table>
Not sure why Python loops have always given me so much trouble, but
any help would be awesome!