
python
历史相似
这个作者很懒,什么都没留下…
展开
-
python的import详解
标准的导入模块 在Python中所有加载到内存中的模块都存在于sys.modules 当 import 一个模块时首先会在这个列表中查找是否已经加载了此模块: 如果加载了则只是将模块的名字加入到正在调用 import 的模块的 Local 名字空间中。 如果没有加载则从 sys.path 目录中按照模块名称查找模块文件,模块可以是py、pyc、pyd,找到后将模块载入内存,并加到 sys.转载 2016-05-13 19:03:00 · 297 阅读 · 0 评论 -
when i run server i got "name 'http' is not defined" after import http.server then i got this "no mo
http.server only exists in Python 3. In Python 2, you should use the BaseHTTPServer module: from BaseHTTPServer import BaseHTTPRequestHandler should work just fine. so if you run in py3 is ok 在转载 2016-05-16 18:59:59 · 416 阅读 · 0 评论 -
python的http服务
用于搭建http server的模块有如下三种: 1)BaseHTTPServer:提供基本的Web服务和处理器类,分别是HTTPServer及BaseHTTPRequestHandler; 2)SimpleHTTPServer:包含执行GET和HEAD请求的SimpleHTTPRequestHandler类; 3)CGIHTTPServer:包含处理POST请求和执行的CGIHTTPReq转载 2016-05-16 19:08:33 · 797 阅读 · 0 评论 -
python的web问题
1,-不能出现为url名 2,@表示mac特殊标记 sudo xattr -c 那个文件 3,python端口得换原创 2016-05-16 21:17:07 · 319 阅读 · 0 评论 -
python调试
比如要对这个程序进行调试: 1:在文件前面加上这一句,引入调试的模块。 import pdb 2:在要开始调试的一行加上pdb.set_trace()文件变成: # epdb1.py -- experiment with the Python debugger, pdb import pdb a = "aaa" pdb.set_trace() b =转载 2016-05-15 11:18:00 · 337 阅读 · 0 评论 -
如何上传python
https://pypi.python.org/pypi转载 2016-05-13 20:30:04 · 285 阅读 · 0 评论 -
执行py文件
1,修改目录 #!/usr/bin/python # -*- coding: UTF-8 -*- import os, sys path = "/tmp" # 查看当前工作目录 retval = os.getcwd() print "当前工作目录为 %s" % retval # 修改当前工作目录 os.chdir( path ) # 查看修改后的工作目录 retva转载 2016-05-13 19:27:20 · 361 阅读 · 0 评论