Python - 删除列表表示中的括号,逗号和引号

时间:2015-09-29 20:16:29

标签: python join dictionary

我查看了之前的条目,由于人们使用的代码,它们相对难以理解。我已经使用了连接功能,但它无法正常工作。我试图将列表列表加入到单个字符串中,输出应该将每个连接的子列表用空格分隔:

Five = 5

Converted = [chr(i) for i in addof]

#converts the numbers into letters of a not mentioned here variable(addof)

grouped = [converted[i:i+five] for i in range(0, len(converted), five)]

#groups the letters into groups of five

print("".join(map(str, grouped)))

#trying to use the join function in order to remove brackets etc. but it doesnt work

####################### OUTPUT ######################

['V', 'r', 'p', 'h', 'z']['k', 'h', 'u', 'h', 'l']['q', 'o', 'd', 'P', 'd']['q', 'f', 'k', 'd', '/']['l', 'q', 'd', 's', 'o']['d', 'f', 'h', 'z', 'k']['r', 'v', 'h', 'q', 'd']['p', 'h', 'L', 'g', 'r'] 

有人可以帮忙吗? 感谢

1 个答案:

答案 0 :(得分:0)

尝试:

[''.join(x) for x in grouped]