python: object Proprietary method专有方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | """ StudentScoreInfo.py 学生成绩类 date 2023-06-16 edit: Geovin Du,geovindu, 涂聚文 ide: PyCharm 2023.1 python 11 """ import datetime import sys import os class StudentScore( object ): """ 学生成绩类 """ def __init__( self ,ScoreId: int ,StudentId: int ,CourseId: int ,Score: float ): """ 构造函数(方法) :param ScoreId: ID :param StudentId:学生ID :param CourseId:课程ID :param Score:成绩 """ self ._StudentId = StudentId self ._CourseId = CourseId self ._Score = Score self ._ScoreId = ScoreId def __init__( self ): """ 必须写后 """ self ._StudentId = 0 self ._CourseId = 0 self ._Score = 0 self ._ScoreId = 0 ''' def __del__(self): """ :return: """ print(f"{self._StudentId}") ''' def setStudentId( self ,StudentId): """ :param StudentId: :return: """ self ._StudentId = StudentId def getStudentId( self ): """ :return: """ return self ._StudentId def setCourseId( self ,CourseId): """ :param CourseId: :return: """ self ._CourseId = CourseId def getCourseId( self ): """ :return: """ return self ._CourseId def setScore( self ,Score): """ :param Score: :return: """ self ._Score = Score def getScore( self ): """ :return: """ return self ._Score def setScoreId( self ,ScoreId): """ :param ScoreId: :return: """ self ._ScoreId = ScoreId def getScoreId( self ): """ :return: """ return self ._ScoreId def __str__( self ): """ :return: """ return f "{self._ScoreId},{self._StudentId},{self._Score},{self._CourseId}" def __iter__( self ): """ :return: """ return self def __next__( self ): """ :return: """ self ._ScoreId, self ._StudentId, self ._CourseId, self ._Score = self ._ScoreId, self ._StudentId, self ._CourseId, self ._Score return self ._ScoreId, self ._StudentId, self ._CourseId, self ._Score def __getitem__( self ,n): """ :param n: :return: """ for x in range (n): self ._ScoreId, self ._StudentId, self ._CourseId, self ._Score = self ._ScoreId, self ._StudentId, self ._CourseId, self ._Score return self ._ScoreId, self ._StudentId, self ._CourseId, self ._Score def __getattr__( self ,name): """ :param name: :return: """ if name = = "ScoreId" : return self ._ScoreId if name = = "StudentId" : return self ._StudentId if name = = "CourseId" : return self ._CourseId if name = = "Score" : return self ._Score def __call__( self ): """ :return: """ #return f"{self._ScoreId},{self._StudentId},{self._CourseId},{self._Score}" return ( self ._ScoreId, self ._StudentId, self ._CourseId, self ._Score) |
调用:
1 2 3 4 5 6 7 8 | stuscroe = Model.StudentScoreInfo.StudentScore() stuscroe.setStudentId( 1 ) stuscroe.setScore( 80 ) stuscroe.setScoreId( 5 ) stuscroe.setCourseId( 2 ) print (stuscroe.Score) print (stuscroe()) |
哲学管理(学)人生, 文学艺术生活, 自动(计算机学)物理(学)工作, 生物(学)化学逆境, 历史(学)测绘(学)时间, 经济(学)数学金钱(理财), 心理(学)医学情绪, 诗词美容情感, 美学建筑(学)家园, 解构建构(分析)整合学习, 智商情商(IQ、EQ)运筹(学)生存.---Geovin Du(涂聚文)
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下
2020-06-24 csharp: Cyotek.GhostScript.Pdf Conversion pdf convert image
2020-06-24 csharp: using Acrobat.dll pdf convert images in winform
2016-06-24 csharp:VerifyCode in winform or webform
2015-06-24 csharp:获取 DNS、网关、子网掩码、IP
2015-06-24 csharp: using wininet.dll
2013-06-24 csharp:汉字转带拼音声调