How can I catch values from other def by flask???

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Jul 2 08:20:09 EDT 2014


On Wed, 02 Jul 2014 02:43:28 -0700, fk26541598fk wrote:

> this is my code


Change the code as shown below:

> def aa():
>     if request.method=='POST':
>         get_test(value1)
>         return value1

def aa():
    if request.method=='POST':
        value1 = post_test()
        return value1

>     else:
>         get_test(value2)
>         return value2

    else:
        value2 = get_test()
        return value2


>     return 'it does not work'
> 
> def post_test(value1):
>     value1='POST it works'
>     return value1

def post_test():
    return 'POST it works'


> def get_test(value2):
>     value2='GET it works'

def get_test():
    return 'GET it works'



-- 
Steven



More information about the Python-list mailing list