易截截图软件、单文件、免安装、纯绿色、仅160KB

IIS 7 python 2.6 cgi 文件上传问题

我每次上传的文件读到的数据都不正确。2M 的图片读得10多K 。。哪位大侠可以帮帮我啊。
#!D:\ProgrammerTools\python26\python.exe
#encoding=utf-8
import cgitb
import os

cgitb.enable()
import cgi,urllib, md5
print "Content-type: text/html"
print""
print """<?xml version="1.0" encoding="utf-8" ?>
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>asdsadas</title></head><body>"""
form = cgi.FieldStorage()
if form.has_key('file'):
  fileitem = form['file']
  if not fileitem.file:
  print "Error: not a file upload.<P>"
  else:
   
  datas=[]
  while True:
  data = fileitem.file.read(1024)
  if not data:
  break
  datas.append(data)
  for d in datas:
  file(cgi.escape(fileitem.filename).decode("utf-8"),'wb').write(d)
else:


相关问答:

python的引用计数

我用了def CreateMyDialog(self):
        dlg = MyDialog(None, -1, ''.decode('utf8'), (300,300), (300,200), wx.DEFAULT_DIALOG_STYLE | wx.DIALOG_NO_PARENT )
&nbs ......

用Python实现一个简单的通讯录

各位高手,哪位能写个简单的通讯录,只保存姓名和手机号,能保存到硬盘并可读回,有添加,删除,修改,查询功能,命令行式的就行
这种活你得自己干,有问题可以问,但不会有人帮你做的。

给你源码
http://dow ......

看看这段Python代码问题出在哪

照着书上写的,执行时报错(Python2.6)
import wx
class InsertFrame(wx.Frame):
    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,'F ......

谁用过python 的mock 做unit test

如果一段代码

Python code:

#!/usr/bin/python2.5
from urllib2 import Request,urlopen,URLError
def check():
req = Request('http://www.google.com')
try:
res = urlopen(req).read()
......

初学PYTHON,大家主要用它来做什么

    刚接触,感觉功能比较强大,主要是粘合性好,可以有机结合其他语言。但不明白它主要应用于什么领域,主要做那方面的东东。开发ERP系统是否可行?
基本上什么都可以做

今天去看了一下,基本上什么 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号