上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 50 下一页
摘要: 记得更换文件地址 f=open("F:\\vsnode\\python\\example.txt","r+") str=f.read() f.close() ans=[] for i in str: if i.isupper(): ans.append(i.lower()) if i.islower 阅读全文
posted @ 2022-06-02 15:44 kingwzun 阅读(91) 评论(0) 推荐(0)
摘要: 原文 1、什么是“鸭子类型” 所谓 鸭子类型 就是:**如果一只鸟走起来像鸭子、游泳起来像鸭子、叫起来也像鸭子,那么它就是鸭子。**这个概念的名字来源于 James Whitcomb Riley 提出的鸭子测试。 鸭子类型(英语:duck typing)在程序设计中是动态类型的一种风格。 在鸭子类型 阅读全文
posted @ 2022-06-02 09:32 kingwzun 阅读(236) 评论(0) 推荐(0)
摘要: 写了很多冗余数据:车型名称可以不要 class Che: id=0 name='A' maxpeo=0 weight=0 meo=0 def __init__(self,id,name,maxpeo,weight,meo): self.id=id self.name=name self.maxpeo 阅读全文
posted @ 2022-06-02 08:52 kingwzun 阅读(306) 评论(0) 推荐(0)
摘要: 原因: python只允许一个**init** 函数构造类 法1:将init的参数改为不定长参数: 方法思路: 将__init__ 的参数改为不定长参数, 然后在__init__ 中通过判断参数的数量,进行不同的操作 class Rect: __length = 0 __width = 0 # 使用 阅读全文
posted @ 2022-06-01 20:07 kingwzun 阅读(9361) 评论(3) 推荐(1)
摘要: 知识点: python创建多个构造方法 使用classmethod 将init的参数设为可变类型,在init语句中判断 class Rect: __length = 0 __width = 0 def __init__(self, l, w): self.__length = l self.__wi 阅读全文
posted @ 2022-06-01 19:48 kingwzun 阅读(358) 评论(0) 推荐(0)
摘要: Filter过滤器简介 Filter被称作过滤器或者拦截器,其基本功能就是对Servlet容器调用Servlet的过程进行拦截,从而在Servlet进行响应处理前后实现一些特殊功能。 当浏览器访问服务器中的目标资源时,会被Filter拦截,在Filter中进行预处理操作,然后再将请求转发给目标资源。 阅读全文
posted @ 2022-06-01 16:59 kingwzun 阅读(55) 评论(0) 推荐(0)
摘要: https://blog.csdn.net/g13197895299/article/details/123017413 解决方案: 阅读全文
posted @ 2022-06-01 16:24 kingwzun 阅读(329) 评论(0) 推荐(0)
摘要: from abc import ABCMeta, abstractmethod import math from webbrowser import BaseBrowser class Shape: __metaclass__=ABCMeta @abstractmethod def length(s 阅读全文
posted @ 2022-06-01 15:47 kingwzun 阅读(608) 评论(0) 推荐(0)
摘要: Python __ 面向对象基础 import math as m class Rect: l = 0.0 h = 0.0 z = 0.0 def __init__(self, l, h, z): self.l = l self.h = h self.z = z def length(self): 阅读全文
posted @ 2022-06-01 14:35 kingwzun 阅读(574) 评论(0) 推荐(0)
摘要: from cgi import print_arguments class Time: __hour=0 __minute=0 __second=0 #设置数据成员hour的值(采用12小时制),非法的输入默认为12; def setHour(self, h): if h>12 or h<0: se 阅读全文
posted @ 2022-06-01 11:08 kingwzun 阅读(694) 评论(0) 推荐(0)
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 50 下一页