python的property语法的使用

Python中有一个property的语法,它类似于C#的get set语法,其功能有以下两点: 将类方法设置为只读属性; 实现属性的getter和setter方法; 下面着重说明这两点: 将类方法设置为只读属性 首先请阅读下面的代码 1 2 3 4 5 6 7 8 9 class  Book( object ):      def  __init__( self , title, author,
相关文章
相关标签/搜索