练习10-9:静默的猫和狗 修改你在练习10-8中编写的except代码块,让程序在任意文件不存在时静默失败。 filename ='dogs.txt'try: with open(filename) as f: content=f.readlines()exceptFileNotFoundError:#print(f'{filename}该文件未找到!')passelse:forcatsincontent:print(cats.rstrip()) 练习10-10:常...
1try:2x = input("Give me a number:")3x =int(x)45y = input("Give me another number:")6y =int(y)78exceptValueError:9print("你他妈好像瞎,你睁开你的狗眼看看你输入的是数字吗")1011else:12sum = x +y13print(f"The sum of {x} and {y} is {sum}") 练习10-7 加法计算器 将你为完...
[11] 2-6matplotlib绘制多次... 862播放 18:20 [12] 3-1绘制散点图(上) 1193播放 07:47 [13] 3-1绘制散点图(下) 968播放 07:44 [14] 3-2绘制条形图(上) 807播放 09:13 [15] 3-2绘制条形图(下) 762播放 09:17 [16] 3-4绘制直方图(上) ...
print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())) 祝大家Python学习顺利!没有 B U G~
前五套练习 小rrrrr:python——pandas练习题1-53 赞同 · 0 评论文章 练习6-统计 探索风速数据 相应数据集:wind.data importpandasaspdimportdatetimedata=pd.read_table(r"exercise_data/wind.data",sep="\s+",parse_dates=[[0,1,2]])data.head() ...
python核心编程第六章练习6-10 6-10. 字符串。写一个函数,返回一个跟输入字符串相似的字符串,要求字符串的大小写反转,比如,输入“Mr.Ed”,应该返回“mR.eD”作为输出。 【答案】 代码如下: 1 2 3 4 5 6 7 8 9 10 11 12 #!/usr/bin/env python...