slpp icon indicating copy to clipboard operation
slpp copied to clipboard

0 开始连续的就变成列表,1 开始连续就是字典

Open Fowver opened this issue 1 year ago • 0 comments

from slpp import slpp as lua

content = '{[0]={0},[1]={3},[2]={6},[3]={9},[4]={12},[5]={15}}' content1 = '{[1]={6},[2]={12},[3]={18},[4]={24},[5]={30}}' table_data_dict = lua.decode(content) table_data_dict1 = lua.decode(content1)

print(type(table_data_dict)) # <class 'list'> print(type(table_data_dict1)) # <class 'dict'> print(table_data_dict) # [[0], [3], [6], [9], [12], [15]] print(table_data_dict1) # {1: 6, 2: 12, 3: 18, 4: 24, 5: 30}

为什么table_data_dict1得到的是列表,table_data_dict1得到的是字典,可以让0开始的也得到字典格式吗

Fowver avatar Nov 27 '24 07:11 Fowver