After the loop ends, I want to get the results together for the last time.

Asked 2 years ago, Updated 2 years ago, 44 views

It was difficult to understand the question, so I will write down the code and the results I want.
·I mistook it for recursive, so I changed the title as well

What do you want to do in the end
·I want to display the results of this link on the web screen using Bottle

Tried

·Examples of screen display results

['/wiki/Randy_Quaid']

·The above was passed to the template at the time of the loop, so I would like to collect the results and give them to the template after the loop ends, so when I changed it to the following, I fell into an infinite loop, but is it Naze?

·Image of the result you want in the end (it's just the expected range)

['/wiki/Richard_Chamberlain', '/wiki/Richard_Chamberlain']

The following initial questions

·What should I do if I want to obtain the following code together after the loop ends instead of outputting it at any time during the loop?

·Retrieved as an object composed of strings?
*In the first place, I don't really understand the format of acquisition itself

·I tried but it doesn't work (infinite loop?) code

python

2022-09-30 21:23

2 Answers

I can't get the hang of the question. Is this what you mean?

def getHoge(p):
    return treatment

defaulthoge(res, results=[]):
    iflen(res)>0:
        str = processing
        results.append(str)
        hoge(getHoge(str), results)
    return results

hoge(getHoge("string"))

The original code does not update res, so if len(res)>0 first, it will be an infinite loop.
Also, I didn't know what the variable links meant, so I thought of it as links==res.


2022-09-30 21:23

How about the following

def getHoge(p):
    return treatment

def hoge():
    results = [ ]
    res=getHoge("string")
    whilelen(res)>0:
        str = processing
        results.append(str)
        res=getHoge(str)
    return results

results=hoge()


2022-09-30 21:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.