将嵌套的缩进文本解析为列表
你好,
也许有人可以给我一个开始帮助。
我已经嵌套了与此类似的缩进 txt。我应该将其解析为嵌套列表结构,例如
TXT = r"""
Test1
NeedHelp
GotStuck
Sometime
NoLuck
NeedHelp2
StillStuck
GoodLuck
"""
Nested_Lists = ['Test1',
['NeedHelp',
['GotStuck',
['Sometime',
'NoLuck']]],
['NeedHelp2',
['StillStuck',
'GoodLuck']]
]
Nested_Lists = ['Test1', ['NeedHelp', ['GotStuck', ['Sometime', 'NoLuck']]], ['NeedHelp2', ['StillStuck', 'GoodLuck']]]
任何对 python3 的帮助都会被应用