如何通过解释器查看 Python 运算符列表?
解释器中的 help 方法对于此类操作非常有用。它提供了一组丰富的特殊输入,你可以使用它们来获取有关语言不同方面的相关信息。除去运算符列表,以下是你能够使用的部分命令:
所有运算符
>>> help('SPECIALMETHODS')
基本运算符
>>> help('BASICMETHODS')
Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.
数值运算符
>>> help('NUMBERMETHODS')
除了运算符之外,你还可以使用 − 来获取属性方法、可调用方法等
>>> help('MAPPINGMETHODS') >>> help('ATTRIBUTEMETHODS') >>> help('SEQUENCEMETHODS1') >>> help('SEQUENCEMETHODS2') >>> help('CALLABLEMETHODS')
广告