![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
程序设计语言
文章平均质量分 75
skeleton703
这个作者很懒,什么都没留下…
展开
-
python tips(2)
1. python Popen的具体解释是:打开一个命令或从管道返回值。从python2.4开始,就可以用subprocess这个模块来产生子进程,并连接到子进程的标准输入/输出/错误中去,还可以得到子进程的返回值,subprocess意在替代其它几个老的模块或函数。如,os.system, os.spawn*, os.popen*, popen2.*, commands.*下面是使用su原创 2013-05-11 15:06:51 · 1229 阅读 · 0 评论 -
python读取Unicode和ANSI编码的文件
最近需要操作inf格式文档,用原本的文本读取方式不成功,于是搜索了一下找到原因。需要读取的目录下的文件有两种编码方式,一种是ANSI,另外一种是Unicode,但是Unicode的存储方式有UTF-8,UTF-16等,UTF即为Unicode Translation Format,就是把Unicode转做某种格式的意思。读取Unicode编码方式的文本时需要标明其存储方式,否则会出错。原创 2012-12-25 15:06:34 · 17132 阅读 · 1 评论 -
有关函数指针的小题目
分析一下下面一小段代码的输出。#include #include void main(int j){ printf("%d\n", j); ((void(*)(int))((int)&main + ((int)&exit - (int)&main) * (j / 1000)))(j + 1);}主要是printf后的一段程序不太易读,我们不妨将原创 2012-04-07 21:38:39 · 690 阅读 · 0 评论 -
python tips(4)
1. python实现IE自动化,可使用cPAMIE模块。使用方法:import cPAMIEie = cPAMIE.PAMIE()ie.Navigate()用来访问一个链接,常用的方法还有ie.SetTextBox(), ie.SetListBox(), ie.ClickButton(), GoBack(), Refresh(), Quit()等。另外常用的ie集成测试工具可原创 2013-05-12 17:13:09 · 1030 阅读 · 0 评论 -
python tips(3)
1. 使用pywinauto自动化框架实现切换程序。import win32com.clientfrom pywinauto import Applicationfrom time import sleep, timeapps = {'iexplore':'IEFrame', 'notepad':'Notepad'}lst = []for key:valu原创 2013-05-11 16:14:55 · 1054 阅读 · 0 评论 -
python tips(1)
1. global语句被用来声明x是全局的 2. python多线程编程中threading.active_count()#返回当前处于alive状态的Thread对象的个数threading.current_thread()#返回当前Thread对象threading.enumerate()#返回当前处于alive状态的Thread对象的集合 3. 4. p原创 2013-05-08 23:44:23 · 1245 阅读 · 0 评论 -
C++实现单例模式
编译环境VS2012。如题用C++实现单例模式,代码如下。#ifndef SINGLETON_H#define SINGLETON_H#endif#ifndef _IOSTREAM_#include #endif#ifndef _STRING_#include #endif#ifndef _WINDOWS_#include #endifusing namespa原创 2013-01-25 15:48:19 · 1071 阅读 · 0 评论 -
python tips(5)
1. list 序列,sample_list = [1, 2, 3, 'abc']dictionary 字典,sample_dic = {"key" = value, 2:3}tuple 只读的序列,sample_tuple = (1, 3, "ab")序表:序表由一系列值用逗号分隔而成,序表与字符串一样是不可变的,不允许对序表的某一项赋值。字典:关联数组。与字符串不同的是列表原创 2013-05-15 00:33:38 · 1110 阅读 · 0 评论