11 2017 档案

摘要:# 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 魏桐 阅读(3095) 评论(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 魏桐 阅读(252) 评论(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 魏桐 阅读(114) 评论(0) 推荐(0)
摘要:在Python 中,日期和时间可能涉及好几种不同的数据类型和函数。下面回顾了表示时间的3 种不同类型的值: Unix纪元时间戳(time模块中使用)是一个浮点值或整型值,表示自 1970年1月 1日午夜 0点(UTC)以来的秒数。 datetime 对象(属于datetime 模块)包含一些整型值, 阅读全文
posted @ 2017-11-14 11:45 魏桐 阅读(267) 评论(0) 推荐(0)
摘要:import json, pprint# 支持的类型:字典、列表、整型、浮点型、字符串、布尔型或Nonedef LoadsAndDumps(): stringOfJsonData = '{"name": "Zophie", "isCat": true, "miceCaught": 0, "felin 阅读全文
posted @ 2017-11-10 15:43 魏桐 阅读(229) 评论(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 魏桐 阅读(287) 评论(0) 推荐(0)