随笔分类 - python
摘要:##Using Queue with multiprocessing – Chapter 3: Process Based Parallelism import multiprocessing import random import time class producer(multiprocessing.Process): def __init__(self, queue): ...
阅读全文
摘要:#!/usr/bin/python3 def KelvinToFahrenheit(Temperature): assert (Temperature >= 0),"Colder than absolute zero!" return ((Temperature-273)*1.8)+32 print (KelvinToFahrenheit(273)) print (int(Ke...
阅读全文
摘要:例1 输出 例2 输出 例3 输出 例4 输出 例5
阅读全文
摘要:def interpolation_search(data,val): low=0 high=len(data)-1 print('查找过程中......') while low data[mid]: print('%d 介于中间值位置 %d[%3d] 和 %d[%3d] 之间,找右半边' \ %(v...
阅读全文
摘要:def bin_search(data,val): low=0 high=len(data)-1 while low data[mid]: print('%d 介于中间值位置 %d[%3d] 和 %d[%3d] 之间,找右半边' \ %(val,mid+1,data[mid],high+1,data[high...
阅读全文
摘要:import random val=0 data=[5,6,7,8,9] while val!=-1: find=0 val=int(input('请输入查找键值(1-9),输入-1离开:')) for i in data: if i==val: print('在第 %3d个位置找到键值 [%3d]' %(i+1,i)) ...
阅读全文
摘要:match函数 输出 search函数 输出 匹配与搜索 输出 搜索和替换 输出
阅读全文
摘要:一个简单的服务器 一个简单的客户端
阅读全文
摘要:thread模块 输出 threading模块 输出 同步线程 输出 多线程优先级队列 输出
阅读全文
摘要:movies.xml 使用SAX API解析XML 输出 使用DOM API解析XML 输出
阅读全文
摘要:例子一 例子二 的实现为 例子三 for i in PowTwo(5): print(i) 输出 执行 例子四 返回所有奇数 执行
阅读全文
摘要:例子一 执行 例子二 输出 例子三 输出 上面的 相当于
阅读全文
摘要:一 二 例子1 输出 例子2 输出 例子3 反转字符串的生成器 输出
阅读全文
摘要:def make_multiplier_of(n): def multiplier(x): return x * n return multiplier # Multiplier of 3 times3 = make_multiplier_of(3) # Multiplier of 5 times5 = make_multiplier_of(5) # O...
阅读全文

浙公网安备 33010602011771号