我想在Python中擴展一個元素到列表中,但是,而不是在索引'i'中擴展字符串它擴展字符串的每個字符在索引'我'。Array.extend(字符串)添加每個字符,而不是隻字符串
例如,我有一個名爲'strings'的列表,只有一個字符串'string1'和一個名爲'final_list'的空列表。
我想將'strings'的第一個元素擴展到'final_list',所以我做了final_list.extend(strings[0])
。但是,而不是「final_list」結束與長度1,對應插入該字符串時,列表結束了的7
如果有幫助的長度,這是我的代碼:
con = connect()
i = 0
new_files = []
while i < len(files):
info_file = obter_info(con, files[i])
if info_file [5] == 0: #file not processed
new_files.append(files[i])
i += 1
有誰知道我該如何使這個工作?
這實際上幫了很多,謝謝。 – undisp