字符串转换成列表
列表转换成字典
column = "ID,aes,sm4,sm4_a,email,phone,ssn,military,passport,intelssn,intelpassport,intelmilitary,intelganghui,inteltaitonei,credit_card_short,credit_card_long,job,sm4_cbc,sm4_a_cbc"
value = "1,HMF,北京XXX技术有限公司,北京市朝阳区明天第一城6-901,[email protected],15652996964,110103201206200910,武水电字第3632734号,BWP018930705,110103201206200910,BWP018930705,武水电字第3632734号,H21157232,9839487602,117,6212262502009182455,测试开发工程师,北京XXX技术有限公司,产品研发部"
#字符串转换成列表
colnmn_list=column.split(",")
value_list=value.split(",")
print(colnmn_list)
print(value_list)
#两个列表转换成字典
value_dict = dict(zip(colnmn_list,value_list))
print(value_dict)
column = "ID,aes,sm4,sm4_a,email,phone,ssn,military,passport,intelssn,intelpassport,intelmilitary,intelganghui,inteltaitonei,credit_card_short,credit_card_long,job,sm4_cbc,sm4_a_cbc"
value = "1,HMF,北京XXX技术有限公司,北京市朝阳区明天第一城6-901,[email protected],15652996964,110103201206200910,武水电字第3632734号,BWP018930705,110103201206200910,BWP018930705,武水电字第3632734号,H21157232,9839487602,117,6212262502009182455,测试开发工程师,北京XXX技术有限公司,产品研发部"
value_params = tuple(value.split(","))
print(value_params)
元组是Python编程语言中的一个基本数据类型,它是一个不可变的序列,其中的元素不能被修改。通过修改转换成列表,修改类型后,再转换成元组,更改某些值的数据类型。
column = "ID,aes,sm4,sm4_a,email,phone,ssn,military,passport,intelssn,intelpassport,intelmilitary,intelganghui,inteltaitonei,credit_card_short,credit_card_long,job,sm4_cbc,sm4_a_cbc"
value = "1,HMF,北京XXX技术有限公司,北京市朝阳区明天第一城6-901,[email protected],15652996964,110103201206200910,武水电字第3632734号,BWP018930705,110103201206200910,BWP018930705,武水电字第3632734号,H21157232,9839487602,117,6212262502009182455,测试开发工程师,北京XXX技术有限公司,产品研发部"
#字符串转换成列表,第一个元素是字符串类型
list_value=value.split(",")
#更改元组一个元素的类型
list_value[0] =int(list_value[0])
value_params = tuple(list_value)
print(value_params)