有些在Python中使用字符串

有些在Python中使用字符串,python,Python,我有以下代码: estructuraDatos = [(here goes the information)] for campo in estructuraDatos: for x in range(len(campo)): print campo[x] 它会打印: 000d109e4a25299eeef77a14d6b6a81479d1ac0e United States wilco 110 0.016042000875 [['eli

我有以下代码:

    estructuraDatos = [(here goes the information)]
    for campo in estructuraDatos:
       for x in range(len(campo)):
          print campo[x]
它会打印:

   000d109e4a25299eeef77a14d6b6a81479d1ac0e
United States
wilco
110
0.016042000875
[['elizabeth mitchell', '0.0482718389966'], ['phish', '0.0274172378591'], ['girl talk', '0.0253755286568'], ['roxette', '0.0245005104273'], ..., ['little feat', '0.00627096397842\n']]
我怎样才能把它打印成一张表格,是不是说:

身份证。。。。这个国家。。。。小组。。。等

其中点是空间

谢谢

 lst = [['elizabeth mitchell', '0.0482718389966'], ['phish', '0.0274172378591'], ['girl talk', '0.0253755286568'], ['roxette', '0.0245005104273'], ['little feat', '0.00627096397842\n']]  
 >>> def print_nested(lst):
        album = ''
        for each in lst:
            if isinstance(each, list):
                print_nested(each)
                album =''
            else:
                album +=  str(each) + ' '
        print(album)


    >>> print_nested(lst)
    elizabeth mitchell 0.0482718389966 
    phish 0.0274172378591 
    girl talk 0.0253755286568 
    roxette 0.0245005104273 
    little feat 0.00627096397842
如果函数遇到嵌套列表,则递归调用该函数。不过,我认为你在问题中列出的列表中没有你想要的所有数据。

试试这个:

for campo in estructuraDatos:
    print(' '.join(estructuraDatos))

这将循环遍历您拥有的列表列表(我假定),然后使用
(空格)连接元素。

我得到一个
类型错误:序列项0:expected str instance,list find
它表示类型错误:序列项0:expected string,tuple found显示您正在传递的数据示例。