I have a question that how to clear a list that's formed by PyList_Append() ? Is there a document about Python/C extention API functions in detail? Thanks.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
IIRC you have to use PyList_SetSlice
:
PyList_SetSlice(your_list, 0, PyList_Size(your_list), NULL);
回答2:
You can use the PySequence_DelSlice function:
# The same as: del L[0:len(L)]
PySequence_DelSlice(L, 0, PySequence_Length(L));