摘要: # numpy的数据类型,类型转换,占用内存字节数f64 = numpy.float64(42)print(f64, type(f64), f64.dtype, f64.dtype.itemsize)i8 = numpy.int8(42.0)print(i8, type(i8), i8.dtype, 阅读全文
posted @ 2017-11-16 13:19 魏桐 阅读(3045) 评论(0) 推荐(2) 编辑
摘要: import subprocesscalcProc = subprocess.Popen('c:\\Windows\\System32\\calc.exe')subprocess.Popen(['C:\\Windows\\notepad.exe', 'C:\\hello.txt']) 带有参数sub 阅读全文
posted @ 2017-11-14 13:31 魏桐 阅读(242) 评论(0) 推荐(0) 编辑
摘要: import threading, timeprint('Start of program.')def takeANap(): time.sleep(5) print('Wake up!')threadObj = threading.Thread(target=takeANap)threadObj. 阅读全文
posted @ 2017-11-14 13:18 魏桐 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 在Python 中,日期和时间可能涉及好几种不同的数据类型和函数。下面回顾了表示时间的3 种不同类型的值: Unix纪元时间戳(time模块中使用)是一个浮点值或整型值,表示自 1970年1月 1日午夜 0点(UTC)以来的秒数。 datetime 对象(属于datetime 模块)包含一些整型值, 阅读全文
posted @ 2017-11-14 11:45 魏桐 阅读(247) 评论(0) 推荐(0) 编辑
摘要: import json, pprint# 支持的类型:字典、列表、整型、浮点型、字符串、布尔型或Nonedef LoadsAndDumps(): stringOfJsonData = '{"name": "Zophie", "isCat": true, "miceCaught": 0, "felin 阅读全文
posted @ 2017-11-10 15:43 魏桐 阅读(218) 评论(0) 推荐(0) 编辑
摘要: import csv, pprintdef ReadFile2List(): file = open('example.csv') reader = csv.reader(file) data = list(reader) pprint.pprint(data) print(data[0][2]) 阅读全文
posted @ 2017-11-10 10:52 魏桐 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 2013年10月10日 2015年3月30日修正坐标参考模型 1 OGR几何对象模型OGRGeometry 1.1 Geometry 几何图形,最基本的地图图形。注意:包含空间参考。 其它所有的地图图形都是由本类派生出来的。 包含了通用的属性和方法。 注意:空间操作的部分需要GEOS支持,如果没有G 阅读全文
posted @ 2017-10-31 11:28 魏桐 阅读(1725) 评论(0) 推荐(0) 编辑
摘要: import shutil, os, zipfile # 复制、移动、改名、删除文件与文件夹 #shutil.copy('e:\\111\\key.txt', 'd:\\111\\') # copy文件 #shutil.copytree('e:\\111', 'd:\\111\\aaa') # co 阅读全文
posted @ 2017-10-26 15:42 魏桐 阅读(270) 评论(0) 推荐(0) 编辑
摘要: import pprint#格式化打印message = 'It was a bright cold day in April, and the clocks were striking thirteen.'count = {}for character in message: count.setd 阅读全文
posted @ 2017-10-26 13:31 魏桐 阅读(411) 评论(0) 推荐(0) 编辑
摘要: import shelve# shelve_demo.py 持久性字典:Python对象的持久化# 键值对形式, 将内存数据通过文件持久化, 值支持任何pickle支持的Python数据格式# 与pickle的主要区别是键值对方式, 并且在目录下生成三个文件class Person(object): 阅读全文
posted @ 2017-10-26 11:41 魏桐 阅读(299) 评论(0) 推荐(0) 编辑