- 博客(18)
- 收藏
- 关注
原创 raw_input()与sys.stdin.readline()的区别
readline函数用来读取来自键盘的一行文本输入,直到按回车为止import systest1 = raw_input()print len(test1)test2 = sys.stdin.readline()print len(test2)C:\Users\Admin\Desktop>test.pyhello5hello6由此可以看出,用readline时le
2016-10-13 01:04:22 9300
原创 返回100内的素数列表
源码:def prime_numbers(): lst = [] for x in xrange(2,100): for y in xrange(2,x/2 + 1): if x % y == 0: lst.append(x) return [n for n in xrange(2,100) if n not in lst]print prime_numbers()
2016-09-04 17:50:49 558
原创 检查密码的规则合法性
给定一个字符串,用以下规则检查合法性完全符合返回True,否则返回False1.第一位是字母2.只能包含字母,数字,下划线3.只能字母或数字结尾4.最小长度为25.最大长度为10源码:import redef valid_password(pwd): length = len(pwd) if (length >= 2 an
2016-09-04 17:38:19 1932
原创 在字符串中找出连续最长的数字串
设计一个程序,输入一个字符串以“#”结尾,则输出此字符串中连续出现最长的数字串及其下标。例:输入:ab125ef1234567#输出:1234567 开始位置为:7源代码:import rewhile True: inp = raw_input("Enter a string(endwith '#'):") if inp[-1
2016-08-09 18:51:09 557
原创 Python.Calling a JSON API
The program will prompt for a location, contact a web service and retrieve JSON for the web service and parse that data, and retrieve the first place_id from the JSON. A place ID is a textual iden
2016-07-24 21:10:33 604
原创 Python.Extracting Data from JSON
The program will prompt for a URL, read the JSON data from that URL using urllib and then parse and extract the comment counts from the JSON data, compute the sum of the numbers in the file and ente
2016-07-24 20:05:16 1017
原创 Python.Extracting Data from XML
The program will prompt for a URL, read the XML data from that URL using urllib and then parse and extract the comment counts from the XML data, compute the sum of the numbers in the file.XML地址:ht
2016-07-22 20:12:29 620
原创 Python.Following Links in HTML Using BeautifulSoup
The program will use urllib to read the HTML from the data files below, extract the href= vaues from the anchor tags, scan for a tag that is in a particular position relative to the first name in th
2016-07-22 20:01:56 1223
原创 Python.Scraping HTML Data with BeautifulSoup
HTML地址:http://python-data.dr-chuck.net/comments_290548.htmlPython源码:import urllibfrom bs4 import BeautifulSoupurl = raw_input('Enter - ')html = urllib.urlopen(url).read()soup = BeautifulSoup
2016-07-22 19:52:17 584
原创 Python.Lists
Open the file romeo.txt and read it line by line. For each line, split the line into a list of words using the split() method. The program should build a list of words. For each word on each line chec
2016-07-14 17:07:59 521
原创 Please ensure Intel HAXM is properly installed and usable.
之前一直用的是ARM(armeabi-v7a),但是实在是太慢了,今天就换了Intel Atom(x86)结果就出现了如下错误也不知道自己有没有装上Intel HAXM ,那就去SDK里看看结果已经有了所以 直接进目录下安装就好了安装完之后再启动AVD就没问题了
2016-06-16 00:18:08 3752 1
原创 eclipse安装genymotion插件
Help->Install New Software...->AddLocation: http://plugins.genymotion.com/eclipse出现There are no categorized items将Group items by category取消勾选安装,重启
2016-05-24 20:42:31 422
原创 shell下的单引号与双引号
双引号("): 由双引号括起来的字符,除$、倒引号(`)和反斜线(\)仍保留其特殊功能外,其余字符均作为普通字符对待。单引号('):由单引号括起来的字符都作为普通字符出现。eg:a = 1echo "$a" 输出 1echo '$a' 输出$aecho " '$a' " 输出 '1'echo ' "$a" ' 输出 "$a"
2016-04-28 20:06:08 346
原创 虚拟机安装XP怎么更容易进入BIOS
VM安装XP想要进入BIOS真的好难,基本在1s内,永远赶不上。 重新打开好多次,打开VM之后狂按F2,还是没能进去。 不过还是找到了一个好方法。 将虚拟机配置文件(.vmx文件)用记事本打开。 在最前面加入:bios.bootDelay = "5000" 。 这样就会延长画面时间5秒了,足够进入BIOS
2016-04-27 21:48:35 1066
原创 文件描述符(fd)
文件描述符在形式上是一个非负整数。实际上,它是一个索引值,指向内核为每一个进程所维护的该进程打开文件的记录表。当程序打开一个现有文件或者创建一个新文件时,内核向进程返回一个文件描述符。习惯上,标准输入(standard input)的文件描述符是 0,标准输出(standard output)是 1,标准错误(standard error)是 2。当打开一个新的文件,文件描述符将会是3。
2016-04-19 20:52:46 483
原创 Android 监听器
setOnClickListenner 出现错误:The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (new OnClickListener(){})查看所导入的包。看有没有import android.content.
2016-04-07 20:55:54 232
原创 Error when loading the SDK
1.进入sdk目录下,把D:\android-sdks\system-images \android-22\android-wear\armeabi- v7a\devices.xml和D:\android-sdks\system-images\android-22\android-wear \x86\devices.xml文件删除2.再把sdk里面D:\android-sdks\t
2016-03-03 16:18:35 497
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人