Skip to content

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

@Fowver

Description

@Fowver

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开始的也得到字典格式吗

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions