0

将变量设置为从包含变量作为返回列表的函数返回的列表似乎没有给我任何输出:

def get_wordlist(num, s):
    items_in_wordlist = database_get(num)
    print "Trying to get wordlist..."
    print items_in_wordlist
    items = []
    if s == 0:
        for item in items_in_wordlist:
            items.append((item[1]).decode("hex"))
        return items
    elif s == 1:
        for item in items_in_wordlist:
            items.append((item[2]).decode("hex"))
        return items

def get_wordlist_set(self, speed):
    global main_wordlist, main_wordlist_e
    print "Getting wordlist set..."
    #try:
    main_wordlist   = get_wordlist(speed, 1)
    print "Check (1) - Passed"
    main_wordlist_e = get_wordlist(speed, 0)
    print "Check (2) - Passed"
    return main_wordlist

“检查 (*) - Passed”应打印到屏幕上。但是,我得到的只是“设置单词列表......”关于我做错了什么有什么想法吗?

4

1 回答 1

3

正如 sandinmyjoints 所说,如果你看到

Getting wordlist set...

但不是

Trying to get wordlist...

看起来像

database_get(num)

没有回来。也可能是相同的函数名称在其他地方用于不同的函数。在调用之前打印可能是个好主意database_get

于 2012-05-13T01:44:40.787 回答