在Python中是否可以转换以逗号分隔的原始字符串,例如
tt0099700,tt0096061,tt0118688,tt0120784
进入Python数组/列表?
这种字符串作为变量row[i]
循环出现。
感谢您的帮助。
答案 0 :(得分:5)
尝试:
input_list = 'tt0099700,tt0096061,tt0118688,tt0120784'
new_list = input_list.split(',')
new_list
的输出:
['tt0099700', 'tt0096061', 'tt0118688', 'tt0120784']