Python教程

Python教程:包含了所有代写案例以及部分答案

  • 这是一个简单的网络程序,可以用来扫描指定ip的常用端口 from socket import * tgtHost=raw_input("What is the web address?: ") tgtPorts=raw_input("What are the ports seperated by commas? or would you like to test all?: ") def connScan(tgtHost, tgtPort): try: c … 继续阅读“python端口扫描程序”

    :
  • """ python汉字随机组合.py 依山居 7:07 2015/11/11 相关资料 Python random模块 http://my.oschina.net/cuffica/blog/33336 题目来源: http://www.bathome.net/viewthread.php?tid=37773 """ import time import random start=time.time() s="圣诚杰安博彬宝斌 … 继续阅读“python汉字随机组合.py”

    :
  • #B tree class TreeNode: def __init__(self,x): self.val=x self.left=None self.right=None def builtTree(): root=None val=input("Enter the value:") if(val==’#’): pass else: root=TreeNode(val) root.left=builtTree() root.right=builtTree() return … 继续阅读“python 二叉树遍历”

    :
  • # -*- coding:utf-8 -*- class BinDecimal: def printBin(self, num): aa = num*2 rest = [] rest.append(str(int(aa))) while aa != 1: aa = (aa – int(aa))*2 rest.append(str(int(aa))) res = ‘0.’ + "".join(rest) if len(res)>= 32: return "Err … 继续阅读“python 二进制小数”

    :