将变量设置为返回列表,似乎没有做任何事情

时间:2012-05-13 01:20:32

标签: python

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

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

“Check(*) - Passed”应该打印到屏幕上。然而,我所得到的只是“获得wordlist集......”关于我做错的任何想法?

1 个答案:

答案 0 :(得分:3)

正如sandinmyjoints所说,如果你看到了

Getting wordlist set...

但不是

Trying to get wordlist...

看起来像是

database_get(num)

没有回来。也可能是相同的函数名称用于其他地方的不同函数。在调用database_get

之前之前打印可能是个好主意