Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ÖÐÎÄ´¦Àí£¬Íê³É¹¦ÄܵÄʵÓû¯

±¾ÎÄÕª×Ô¡¶¿É°®µÄPython¡·¡°¹âÅ̹ÊÊ¡±CDay-1 ʵÓû¯ÖÐÎÄ¡£
[img]http://t.douban.com/mpic/s3901817.jpg[/img]
CDay-1 ʵÓû¯ÖÐÎÄÖÐÎÄ´¦Àí£¬Íê³É¹¦ÄܵÄʵÓû¯
ÄãÅöµ½99%µÄÎÊÌ⣬ÆäËûÈË֮ǰÒѾ­Óöµ½¹ýÁË£¬Ë ......

Ë­Óùý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 PILÄ£¿é´ò¿ªÍ¼Æ¬ÎÊÌâ

ÇëÎÊÏ£¬ÎÒµÄÊÇpython2.5°²×°ÁËPILÄ£¿é£¬È»ºó±àд³ÌÐò´ò¿ª±¾»úÉϵÄÒ»¸öͼƬʱ£¬ÎªÊ²Ã´ÀϳöÏÖ´íÎóÄØ£¬ÀÏÊÇÕÒ²»µ½Í¼Æ¬£¬´íÎóÌáʾÈçÏ£ºFile "C:\Python25\Lib\site-packages\PIL\Image.py", line 1888, in o ......

[ÌáÎÊ]Python ÈçºÎºöÂÔ whitespace ¶ÁÈë

Ïñ C µÄ scanf() ÄÇÑù
±ÈÈç¶ÁÈë 1 2 3 a b c
ÿ´Î¶ÁÈëÒ»¸ö
ÏÂÃæÕâ¸öÓ¦¸ÃÊÇÄãÏëÒªµÄ°É£º
Python code:

>>> k = raw_input()
0 0123 ds dsl sd
>>> k
'0 0123 ds dsl sd'
>>> ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ