I need help creating a function that returns a value within the URL string and passed back as an integer that I can used in another function.
from flask import Flask
app = Flask(__name__)
Col1= 0
Col2 = 1
Col3 = 2
array = [
[1,2,3,4],
[5,6,7,8],
[9,10,11,12]
]
@app.route ('/<arraynum>')
def findrow(array, custid):
for i, x in enumerate(array):
if id in x:
row = i
return row
I'm not sure how to grab the value at the end of the url that I defined as id.
My end goal is to make this code work
array[findrow(array, id)][Col1]
so that webpage '..../6'
will output '6'