随笔分类 -  Python

Python语言学习过程中遇到的问题
Python中的bytes,str,int等类型转换
摘要:在Python3.2中添加了int.from_bytes(bytes, byteorder, *, signed=False)可实现不固定长度的bytes类型数据转int类型数据1 >>> int.from_bytes(b'\xfc\x00', byteorder='big', signed=True) ##signed标志是否为有符号数2 -10243 >>> int.from_bytes(b'\xfc\x00', byteorder='big', signed=False)4 645125 阅读全文

posted @ 2013-05-18 22:11 甘泉love若水 阅读(13690) 评论(0) 推荐(1)

PyQt遇到的一些问题
摘要:QString最近在使用PyQt GPL v4.10.1 for Python v3.3 (x32)编写界面的时候,总是遇见余下问题:1 >>> from PyQt4 import QtCore2 >>> QtCore.QString('nihao')3 Traceback (most recent call last):4 File "<pyshell#1>", line 1, in <module>5 QtCore.QString('nihao')6 AttributeError 阅读全文

posted @ 2013-05-16 15:05 甘泉love若水 阅读(737) 评论(0) 推荐(0)

python中的编码方式
摘要:python中常用的字符串格式有两种:一种是str类型,一种是bytes类型。str类型和bytes类型的转换:1 >>> str1 = 'hello world!'2 >>> type(str1) ##查看str1的数据类型3 <class 'str'>4 >>> b = str1.encode('utf-8') ##str到bytes的转换5 >>> b,type(b)6 (b'hello world!', <class 'byt 阅读全文

posted @ 2013-05-14 21:55 甘泉love若水 阅读(496) 评论(0) 推荐(0)

Python调用DLL
摘要:cdecl格式的调用要用p = ctypes.cdll.LoadLibrary(‘EasyUSB_DLL.dll’)或者p = ctypes.CDll(‘EasyUSB_DLL.dll’)stdcall用p = ctypes.windll.LoadLibrary(‘EasyUSB_DLL.dll’)或者p = ctypes.WinDll(‘EasyUSB_DLL.dll’)这里有一片别人介绍不同调用约定的文章:__stdcall,__cdecl,_cdecl,_stdcall,。__fastcall,_fastcall 区别简介 阅读全文

posted @ 2013-05-14 15:30 甘泉love若水 阅读(219) 评论(0) 推荐(0)

导航