![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 59
____Emma__
这个作者很懒,什么都没留下…
展开
-
Python数据处理相关小例编程
有5名某界大佬xiaoyun、xiaohong、xiaoteng、xiaoyi和xiaoyang,其QQ号分别是88888、5555555、11111、1234321和1212121,用字典将这些数据组织起来。编程实现以下两个功能: (1)用户输入某一个大佬的姓名后可以输出其QQ号,如果输入的姓名不在字典中则返回提示信息并允许再次输入; (2)寻找所有有QQ靓号(5位数或小于5位数)的原创 2016-05-16 21:29:20 · 4888 阅读 · 0 评论 -
正则表达式
Python 正则表达式详细讲解: http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html转载 2017-04-19 19:26:26 · 159 阅读 · 0 评论 -
正则表达式
Python 正则表达式详细讲解: http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html转载 2016-09-30 20:05:13 · 217 阅读 · 0 评论 -
统计字符串中的字符个数
1统计字符串中的字符个数。(4分) 题目内容: 定义函数countchar()统计字符串中所有出现的字母的个数(允许输入大写字符,并且计数时不区分大小写)。 输入格式: 字符串 输出格式: 列表 输入样例: Hello, World! 输出样例: [0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 3, 0, 0, 2, 0, 0, 1, 0原创 2016-05-09 21:50:11 · 1114 阅读 · 0 评论 -
数据获取编程题
抓取百度贴吧“http://tieba.baidu.com/p/1000000000”至“http://tieba.baidu.com/p/1000000009”这10个页面并以1000000000.html~1000000009.html这样的文件名保存到本地硬盘上(提示:文件写入使用wb模式)。 >>> import urllib.request >>> for i in range(10)原创 2016-05-08 22:48:34 · 320 阅读 · 0 评论 -
前5个默尼森数
>>> from math import sqrt >>> def isprime(x): if x == 1: return False k = int(sqrt(x)) for j in range(2,k+1): if x%j == 0: return False return True >>> def moni(): count=0 list=[] p = 2转载 2016-05-01 21:39:17 · 2175 阅读 · 0 评论 -
Python3与2区别(学习笔记)
一、Hello world! 在2中: >>>print 'hello,world!' hello,world! 在3中: >>> print "hello, world" SyntaxError: Missing parentheses in call to 'print' >>> print('hello,world!') hello,world!原创 2016-04-16 16:17:39 · 482 阅读 · 0 评论 -
Python报错
一、关于缩进问题报错 >>> import trees Traceback (most recent call last): File "", line 1, in import trees File "D:\Python\trees.py", line 9 labelCounts[currentLabel] = 0原创 2016-04-23 10:34:07 · 1091 阅读 · 0 评论 -
循环中的推进
请输出1~100之间的素数(自定义函数的方法): 一、 >>> def isprime(x): if x == 1: return False k = int(sqrt(x)) for j in range(2,k+1): if x%j == 0: return False else: return True >>> for i in range(1,10原创 2016-04-28 21:38:13 · 297 阅读 · 0 评论 -
Python输出出现多于空格的问题
在我的实践中,有一种情况叫输出中出现多余的空格: 比如我想输出hello,xxx!会输出成hello,xxx ! eg: >>> L = ['bart','lisa','adam'] >>> for i in L: print('hello,',i,'!') hello, bart ! #出现多余空格 hello, lisa ! hello, adam ! 改进: 1、使用原创 2016-05-07 22:51:38 · 7784 阅读 · 0 评论 -
while死循环
作为初学者,已经陷入while的几次死循环了。 比如:求100以内所有奇数之和。 用while来实现,我出现了以下死循环: >>> sum = 0 >>> for i in range(1,101): while i%2 != 0: sum += i #死了……因为while条件永远满足 然后我灵机一动: >>> sum = 0 >>> for i in r原创 2016-05-07 22:24:12 · 2829 阅读 · 0 评论 -
用字典创建一个平台的用户信息(包含用户名和密码)管理系统
用字典创建一个平台的用户信息(包含用户名和密码)管理系统,新用户可以用与现有系统帐号不冲突的用户名创建帐号,已存在的老用户则可以用用户名和密码登陆重返系统。你完成了吗?建议程序框架为: def newusers(): enter a name if the name is used in the system: enter again原创 2016-05-17 21:47:43 · 7143 阅读 · 0 评论 -
“本地数据获取”的综合编程迷你项目
(1) 创建一个文件Blowing in the wind.txt,其内容是: #问题非原创 How many roads must a man walk down Before they call him a man How many seas must a white dove sail Before she sleeps in the sand How many times原创 2016-05-06 11:13:39 · 921 阅读 · 0 评论 -
Python基本操作
蜜汁懒…… http://www.cnblogs.com/vamei/p/3174796.html点击打开链接转载 2017-04-22 16:47:50 · 230 阅读 · 0 评论