Lv.1
java党一个个人QQ:3075929352
签名:肝个人网站ing…………
在 【Python作品分享】csv生成【教程贴】 中回复
想起了之前做java自动化办公用jxl生成excel那段时光……………………
为了让程序跑通,jxl的源代码都被我改了……………………………………
2020-08-13T14:20:46 点赞:0
在 这段代码哪错了 中回复
给你改好了,注意人参果类的构造器里应该带上color参数!
class Fruit:
def __init__(self,color = '绿色'):
Fruit.color = color
def harvest(self,color):
print('苹果是'+self.color+'的')
print('苹果原来是'+Fruit.color+'的');
class Apple(Fruit):
color = '红色'
def __init__(self):
print('我是苹果')
super().__init__()
class Sapodilla(Fruit):
def __init__(self,color):
print('\n我是人参果')
super().__init__(color)
def harvest(self,color):
print('水果是'+color+'的')
print('水果原来是'+Fruit.color+'的');
apple = Apple()
apple.harvest(apple.color)
sapodilla = Sapodilla('白色')
sapodilla.harvest('金黄色')2020-08-16T10:47:43 点赞:0
在 【来个大神教教我这个小喵哇】递归(;д;) 中回复
递归,就是让一个方法自己调用自己。
比如阶乘:
def test(x):
if x == 0:
return 1
return x * test(x-1
递归就是这么简单。
最后注意递归方法一定要有递归的结束条件,比如上面代码的第2-3行。没有递归结束条件的递归叫无限递归,无限递归是非常危险的,因为无限递归无法退出,导致内存会分分钟爆满!
2020-08-19T10:09:57 点赞:2
在 【Python作品分享】音乐盒子【作品秀】 中回复

写的很好!
但是实际情况下没有人愿意为了一个播放器去重命名自己的音乐文件,你可以试试在程序初始化时直接把所有的音乐文件的文件名都加载成一个列表,上一首和下一首时直接在这个音乐列表中获取文件名即可
2020-08-22T09:46:54 点赞:0
在 【求助】谁会用python代码给论坛发评论? 中回复
pid获取:
headers = {"Content-Type": "application/json", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; ) AppleWebKit/537.36 (KH喵L, like Gecko) Chrome/81.0.4044.138 Safari/537.36"}
shequ = requests.get('https://shequ.codemao.cn', headers = headers)
soup = BeautifulSoup(shequ.text, 'html.parser')
pid = loads(soup.find_all("script")[0].string.split("=")[1])['pid']2020-08-25T20:37:52 点赞:0
在 为什么在绘制图像时输入import matplotlib.pyplot as plt找不到指定的模块 中回复
没安装就删了重装。
另外你应该准备一个python环境了
2020-08-25T20:40:16 点赞:0
在 【我的世界mod】煤老板们的福利来啦!——CoalToDiamond 中回复
地址:"".join(chr(x) for x in list([104,116,116,112,115,58,47,47,103,105,116,104,117,98,46,99,111,109,47,108,115,107,45,99,104,105,110,97,47,67,111,97,108,84,111,68,105,97,109,111,110,100]))
2020-08-30T10:53:18 点赞:0
在 【 生命不息,折腾不止】一个Python的Mysql库 中回复
修正:
tools.py的最后一个方法:
def readAutoInc(dbName):
sql = "select auto_increment from information_schema.`TABLES` where table_name='"+dbName+"'"
return int(execute(sql)[0])2020-09-08T19:10:34 点赞:0