Python教程
Python教程:包含了所有代写案例以及部分答案
-
from ctypes import * import time import win32file run = True logfile = open(‘.\\log.out’,’w+’);#open log file input = raw_input("Input a string for disk name like \’d:\’ or other:")#input a disk name while run: sectorsPerCluster, bytesPerSe … 继续阅读“python Windows下Python获取磁盘空闲空间并写入日志”
:
-
python检测远程udp端口是否打开 import socket import threading import time import struct import Queue queue = Queue.Queue() def udp_sender(ip,port): try: ADDR = (ip,port) sock_udp = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) sock_udp.sendto("abcd…&qu … 继续阅读“python检测远程udp端口是否打开”
:
-
”’from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice”’ import sys from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice,MonkeyImage from com.android.monkeyrunner.easy import EasyMonkeyDevice from com.android.monkeyrunner.easy i … 继续阅读“python monkeyrunner 代码示例”
:
-
#!/usr/bin/env python # encoding: utf-8 # source: https://github.com/MrLYC/ycyc/blob/dev/tools/analysis_dependency.py import ast import importlib import inspect class Analysis(ast.NodeTransformer): def __init__(self, paths, recursion): self.modules = … 继续阅读“python 分析并输出Python代码依赖的库”
:
-
#!/usr/bin/env python3 # -*- coding: utf-8 -*- r”’ learning.py A Python 3 tutorial from http://www.liaoxuefeng.com Usage: python3 learning.py ”’ import sys def check_version(): v = sys.version_info if v.major == 3 and v.minor >= 4: return True p … 继续阅读“Python代码运行助手”
:
-
#!/usr/bin/env python from Tkinter import * from tkMessageBox import showinfo def reply( ): showinfo(title=’popup’, message=’Button pressed!’) window = Tk( ) button = Button(window, text=’press’, command=reply) button.pack( ) window.mainloop( ) 标签:py … 继续阅读“python programming python 之tkinter初学”
:
-
import random num = random.randint(0,100) times = 0 print "Number(0,100) guess game" print "You will have 10 times to guess" print "Guess out of range will game over immediately!" guess = int(raw_input("guess a numb … 继续阅读“python 第一个猜数字游戏”
:
-
class Zipper: def zipString(self, iniString): nlen = len(iniString) rest =[] i = 0 endflag = 0 while i < (nlen-1): for j in range(i+1, nlen): if iniString[i] == iniString[j]: continue else: rest.append((iniString[i], i, j)) endflag = j break i = j … 继续阅读“python 基本字符串压缩”
:
-
一个非常高效的提取内容关键词的python代码,这段代码只能用于英文文章内容,中文因为要分词,这段代码就无能为力了,不过要加上分词功能,效果和英文是一样的。 # coding=UTF-8 import nltk from nltk.corpus import brown # This is a fast and simple noun phrase extractor (based on NLTK) # Feel free to use it, just keep a link back to … 继续阅读“python 一个非常高效的提取内容关键词的python代码”
: