随笔分类 -  Python

摘要:1、ModuleNotFoundError: No module named 'urllib2' 解决方案: 1)https://blog.csdn.net/weixin_45598506/article/details/112303268 2)https://blog.51cto.com/yuny 阅读全文
posted @ 2022-08-30 11:21 GoodTimeGGB 阅读(66) 评论(0) 推荐(0)
摘要:# 实例:使用while循环 import string s1 = input('请输入一个字符串:\n') letters = 0 space = 0 digit = 0 others = 0 i = 0 while i < len(s1): c = s1[i] i += 1 if c.isalp 阅读全文
posted @ 2019-12-13 13:29 GoodTimeGGB 阅读(26) 评论(0) 推荐(0)
摘要:#isinstance() 函数来判断一个对象是否是一个已知的类型,类似 type()。 #返回值:如果对象的类型与参数二的类型相同则返回True,否则返回False 使用isinstance函数的实例: a=2 print(isinstance(a,int)) # returns True pri 阅读全文
posted @ 2019-12-13 09:31 GoodTimeGGB 阅读(14) 评论(0) 推荐(0)
摘要://:地板除,返回整数结果 /:浮点数除法,返回浮点结果 例: print(3//2) #输出1 print(3/2) #输出1.5 拓展:判断水仙花数 # 题目:打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身。 # 例如:153是一个"水仙花数",因为153 阅读全文
posted @ 2019-12-12 11:38 GoodTimeGGB 阅读(16) 评论(0) 推荐(0)