如果要跟踪标签出现的相关嵌套和上下文,您必须维护自己的栈或者其他数据结构。
If you want to keep track of the relative nesting and context in which a tag occurs, you need to maintain your own stack, or other data structure.
用HTML的术语来讲,如果您可以在某种程度上基于单词出现在嵌套结构中的何处而给单词打分,是不是很好?
In terms of HTML, wouldn't it be nice if you could somehow score words based on where they appear inside a nested structure? For example.
如果这不是您想要的(通常发生这种情况),您可以使用内置的deepcopy函数,它会一直复制任何嵌套的数据结构。
If that's not what you want (and it's almost always not what you want), then you can use the built-in deepcopy function instead, which duplicates any nested data structure "all the way down".
应用推荐