python 中列表和字符串的相互转换
001、
>>> test1 = ["aaa", "bbb", "ccc", "ddd"] >>> test1 ['aaa', 'bbb', 'ccc', 'ddd'] >>> '_'.join(test1) ## 列表转换为字符串 'aaa_bbb_ccc_ddd' >>> test2 = '_'.join(test1) >>> test2 'aaa_bbb_ccc_ddd' >>> test2.split(sep = "_") ## 字符串转换为列表 ['aaa', 'bbb', 'ccc', 'ddd']