Python教程
Python教程:包含了所有代写案例以及部分答案
-
#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进行远程调用的范例演示”
:
-
#!/usr/bin/env python import urllib.request from bs4 import BeautifulSoup mylist = [] print(u’豆瓣电影TOP250:\n 序号 \t 影片名\t 评分\t 评价人数\t 评价’) def crawl(url): headers = {‘User-Agent’:’Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/200912 … 继续阅读“python 批量抓取豆瓣电影TOP250数据”
:
-
# -*- coding:utf-8 -*- class Solution: # array 二维列表 def Find(self, array, target): if array == [[]]: return False nRow = len(array) nCol = len(array[0]) if target < array[0][0] or target > array[nRow-1][nCol-1]: return False else: for i in rang … 继续阅读“python 判断一个整数是否在一个二维数组中”
: