Python教程
Python教程:包含了所有代写案例以及部分答案
-
这段python代码调用windows下的ping命令,通过subprocess在其子进程里面实现,由于windows下的ping和linux下的ping返回的消息不太一样,所以这段python代码要想在linux下运行,需要修改一下正则匹配 import subprocess import re p = subprocess.Popen(["ping.exe", ‘google.com’], stdin = subprocess.PIPE, stdout = subproc … 继续阅读“python实现ping操作并接收返回信息”
:
-
安卓手机的图形锁是3×3的点阵,按次序连接数个点从而达到锁定/解锁的功能。最少需要连接4个点,最多能连接9个点。网上也有暴力删除手机图形锁的方法,即直接干掉图形锁功能。但假如你想进入别人的手机,但又不想引起其警觉的话……你可以参考一下本文(前提条件:手机需要root,而且打开调试模式。一般来讲,如果用过诸如“豌豆荚手机助手”、“360手机助手”一类的软件,都会被要求打开调试模式的。如果要删除手机内置软件,则需要将手机root)。 首先科普一下,安卓手机是如何标记这9个点的。通过阅读安卓 … 继续阅读“python 基于Python的Android图形锁破解程序”
:
-
#coding=UTF8 from turtle import * import turtle, time , random color("purple") pensize(1) speed(1) up() aa = 470*2 bb = 390*2 goto(-470,-390) down() # 第1圈—————— forward(aa-2*0) left(90) #下面那条 forward(bb-2*0) left(90) # 右边往上 forw … 继续阅读“python 用turtle不断的画回字迷宫”
:
-
#!/usr/bin/env python # -*- coding: utf-8 -*- # #——————————————————————————- # Name: # # Author: Small White # # Created: 2014-10-23 # # Python Tested: 3.4.1 # # dependency: # 1) # # Modification Hi … 继续阅读“python 删除文件夹中几天前的文件”
:
-
python定时执行指定的函数“`python time a function using time.time() and the a @ function decorator tested with Python24 vegaseat 21aug2005 import time def print_timing(func): def wrapper(arg): t1 = time.time() res = func(arg) t2 = time.time() print ̵ … 继续阅读“python 定时执行指定的函数”
:
-
1 #!/usr/bin/env python 2 while True: 3 4 score=int(raw_input(‘please input your score(0-100): ‘)) 5 if score >=90 and score <=100: 6 print ‘your are A type’ 7 elif 80<=score<=89: 8 print ‘you are B type’ 9 elif 70<=score<=79: 10 pr … 继续阅读“python if elif else 使用”
:
-
from html.parser import HTMLParser from urllib.request import urlopen from urllib import parse class LinkParser(HTMLParser): def handle_starttag(self, tag, attrs): if tag == ‘a’: for (key, value) in attrs: if key == ‘href’: newUrl = parse.urljoin(sel … 继续阅读“python精简版搜索引擎”
:
-
服务器端代码“`python –– coding: utf-8 –– import SimpleXMLRPCServer server 上面的程式碼 def Show_me_some_message(sMsg):#從遠端呼叫並且帶入參數 print “I see your call %s” % sMsg return “Received, from client Machine 1” de … 继续阅读“python通过xmlrpc进行远程调用的范例演示”
:
-
#coding:utf-8 class Node(object): def __init__(self, data): self.data = data self.next = None class NodeList(object): def __init__(self, node): self.head = node self.head.next = None self.end = self.head def add_node(self, node): self.end.next = node … 继续阅读“python实现单链表”
:
-
调用sax模块处理xml文件。 #重载了三个方法 #处理xml,主要就是写自己的事件处理类 from xml.sax import * class DengHandler(ContentHandler): def startDocument(self): print("—-开始解析xml文档—-") def endDocument(self): print("—-xml文档解析完毕—-") def startElement(self,nam … 继续阅读“python 使用python3.4解析xml文件(sax、dom、etree)”
: