[Solved] When I use the goto module,it works but I got an error: Exception TypeError


You don’t need goto. Period. Just learn to use Python properly.

for i in range(1,10) :
    print i
    if i == 9 :
        print "find 9"
        break 

Applied to your actual code, the solution is almost the same:

for char in chars :
    while True:
        if sem.acquire :
            filename += char
            t = threading.Thread(target=get200, args=(root + filename + xml))
            t.start()
            sem.release()
            match(filename,length)
            break

Which can be made even simpler:

for char in chars :
    while not sem.acquire:
        continue
    filename += char
    t = threading.Thread(target= get200, args=(root + filename + xml))
    t.start()
    sem.release()
    match(filename,length)

4

solved When I use the goto module,it works but I got an error: Exception TypeError