benbenxu

导航

2013年3月19日 #

python os.walk

摘要: 似乎 os.walk() 有点难受, 我每次都要查文档才能搞定.import oscurDir = os.getcwd()for root,dirs,files in os.walk(curDir): #文件夹 for d in dirs: print root+'\\'+d #文件 for f in files: print root+'\\'+f #如果只遍历当前文件夹的文件 break 阅读全文

posted @ 2013-03-19 11:48 benbenxu 阅读(152) 评论(0) 推荐(0)

2013年2月6日 #

虚拟机 Socket 连接失败

摘要: 我的环境是:实体机系统:Windows7虚拟机: VM8, Centos 6.虚拟机使用NAT联网.问题: 在Windows中运行的客户端无法连接到虚拟机运行的服务器程序, 在虚拟机里的客户端没问题.cd /sbinservice iptables stop 阅读全文

posted @ 2013-02-06 15:26 benbenxu 阅读(389) 评论(1) 推荐(0)

python 调试

摘要: #!/usr/bin/python_Debug = Truedef getNum(): return 1if __name__ == '__main__': if _Debug: import pdb pdb.set_trace() a = getNum()断点: b 行号单步跳过: next, n单步进入: step, s显示当前行: list, l执行到断点: continue, c另外pdb在Windows似乎有个bug, continue无法执行到断点的行. 阅读全文

posted @ 2013-02-06 13:47 benbenxu 阅读(146) 评论(0) 推荐(0)

python 多线程

摘要: #coding=utf-8import threadingimport time#互斥锁mutex = threading.Lock()#类形式class MyThreadA(threading.Thread): def __init__(self, threadname): threading.Thread.__init__(self, name=threadname) #线程start def run(self): for i in range(10): mutex.acquire() print s... 阅读全文

posted @ 2013-02-06 10:50 benbenxu 阅读(167) 评论(0) 推荐(0)

2013年2月5日 #

HTML5 + JavaScript 开发环境

摘要: 之前准备Flash + AS3 时, 下载各种令人崩溃的IDE, 很是头疼.相比之下HTML5 极其小清新.1. 编辑器我选择的是Sublime Text 2.支持文件夹管理项目界面简洁支持VIM模式2.调试Google Chrome打开文件->右键审查元素.点左下角的"Unlock into separate window", 调整窗口大小.点这个向右的箭头, 选择代码文件.鼠标下断点F5刷新F8运行F10 nextF11 step更多的用法查相关说明. 阅读全文

posted @ 2013-02-05 15:11 benbenxu 阅读(225) 评论(0) 推荐(0)

2013年2月4日 #

选择 博客

摘要: 本来想自己架一个, DotCloud空间都申请好了, 由于懒惰还是算了吧 :)选择个人主页:1. 速度快.2. 版面简洁.3. 支持文章分类.4. 支持代码语法.5. 可以方便的关注其他程序员的想法.暂定在博客园. 阅读全文

posted @ 2013-02-04 21:57 benbenxu 阅读(77) 评论(0) 推荐(0)