python数据之间的转换
1、两个list转字典
models_name = ['test1', 'test2']
models_state = []
for i in range(len(sections)):
models_state.append(0) # 0:模型可以正常使用 1:模型暂时不能使用,可能正在被重新建模
model_state_dic = dict(zip(models_name, models_state))
2、list转字符串,中间用逗号隔开
src_data_list = [1, 2, 3] tmp_str = ','.join(str(i) for i in src_data_list) # src_data_list=='1,2,3'
3、string的list转int的list
result_list = ['1', '2'] result_list = list(map(int, result_list))
长风破浪会有时,直挂云帆济沧海!
可通过下方链接找到博主
https://www.cnblogs.com/judes/p/10875138.html