Skip to content Skip to sidebar Skip to footer

Web2py Comparing Part Of A Request.vars Element

I have a form with a table with rows containing SELECTs with _names with IDs attached, like this: TD_list.append(TD(SELECT(lesson_reg_list, _name='lesson_reg_' + str(student[4]))))

Solution 1:

In Python, when slicing, the ending index is excluded, so your two slices should be 0:10 and 0:11. To simplify, you can also use .startswith for the first one:

for item in request.vars:
    if item.startswith('lesson_reg'):
        enrolment_id = int(item[11:])
        code = request.vars.item

Post a Comment for "Web2py Comparing Part Of A Request.vars Element"