一个Python编写的简单hangman游戏代码#!/usr/bin/env pythonimport random import cPickle class Hangman(object): '''A simple hangman game that tries to improve your voca……继续阅读 » 水墨上仙 7年前 (2019-08-03) 3159浏览 792个赞
python执行子进程 进程间通信a.pyimport subprocess, timesubproc = subprocess.Popen(['c:\python31\python.exe', 'c:/b.py'], stdin=subprocess.PIPE, shell=True) time.sl……继续阅读 » 水墨上仙 7年前 (2019-08-03) 2313浏览 151个赞
python rpc twisted 服务端和客户端代码演示#服务器端代码如下from twisted.web import xmlrpc, serverclass Example(xmlrpc.XMLRPC): """ An example object to be published. ……继续阅读 » 水墨上仙 7年前 (2019-08-03) 1804浏览 1689个赞
wxpython自定义语法高亮控件,支持python语法高亮,只需要稍加修改就可以支持其它语言的语法高亮import keywordimport wximport wx.stc as stcimport images#--------------------------------------------------------……继续阅读 » 水墨上仙 7年前 (2019-08-03) 1553浏览 259个赞
Go语言实现冒泡法排序算法代码package mainimport "fmt"func main() { arr := []int{4,5,3,29,9} for i:=0;i<len(arr);i++{ for j:=i+1;j<len(arr);j++{ if arr[j] < arr……继续阅读 » 水墨上仙 7年前 (2019-08-03) 3417浏览 2792个赞
Go语言计算指定年月的天数package mainimport ( "fmt" "bufio" "os" "regexp" "strconv")func main() { year := input("year&……继续阅读 » 水墨上仙 7年前 (2019-08-03) 2264浏览 2161个赞
在JavaScript里乘法比除法的性能要好得多,所以同样的程序如果能用乘法就不用除法//除法,慢var my_variable = 5 / 2;//乘法,快var my_variable = 5 * 0.5; ……继续阅读 » 水墨上仙 7年前 (2019-08-03) 3439浏览 502个赞