求和一个仅在Python中计为一个索引的列表

时间:2017-03-19 03:49:45

标签: python

嗨,我是初学者,我试图总结一个列为一个指数的列表

以下代码用于将卡分发给播放器的代码

def component(self):    
    for card in range(2):
        global componentcard
        componentcard= listcard[card]
        t = (re.findall('\d+', componentcard ))
        x=list(t)
        x = [i.split('\n')[0] for i in x] 
        print x[0],

输出给了我['1'] ['13']其中如果我打印索引0它将给我两个不同的卡值但作为相同的索引0这给我一个问题添加相同的索引任何理念?非常感谢你

0 个答案:

没有答案