ËÄܰïÎÒ·ÖÎöpython¹ú¼Ê»¯±¨´íÎÊÌâ
´íÎó´úÂëÈçÏ£º
<strong>exceptions.UnicodeEncodeError <br /> &#39;ascii&#39; codec can&#39;t encode characters in position 0-5: ordinal not in range(128)</strong>
ÊDz»ÊǶ¨ÒåµÄ×Ö·ûת»¯³ÉASCIIÂð³ö´íÁË£¬ASCIIÂ뷶Χ0-127,³ö½ç
´úÂëÄØ£¿
ÎÒÊÇÔÚPOÎļþÖж¨ÒåµÄ£¬"Content-Type: text/plain; charset=gb2312\n"
"Content-Transfer-Encoding: utf8\n" È»ºóÉú³ÉMOÎļþ£¬Èç¹ûÊÇÄã˵µÄÔÒò£¬ÄÇÔõô±ÜÃâÄØ£¿Ð»Ð»£¡
ºÃÏñÓ¦¸ÃÕâÑù£º
"Content-Type: text/plain; charset=gb2312\n"
"Content-Transfer-Encoding: 8bit\n"
»òÕßÊÇutf-8±àÂëµÄÎļþÊÇ£º
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
reload(sys) OK!!! ÎÊÌâ½â¾ö£¬Ð»Ð»£¡
Ïà¹ØÎÊ´ð£º
ËÍÆ¼öÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл
¡¶python¼òÃ÷½Ì³Ì¡·£¬¡¶pythonºËÐıà³Ì¡·
×÷Ϊϵͳ¹ÜÀí·½Ãæ£¬¡¶Python UNIXºÍLinuxϵͳ¹ÜÀíÖ¸ÄÏ¡·ÊDZ¾·Ç³£²»´íµÄÊé¡£
http://club.book.csdn.net/pic3/255142.jpg
ÒýÓÃ
×÷Î ......
ÎÒÿ´ÎÉÏ´«µÄÎļþ¶Áµ½µÄÊý¾Ý¶¼²»ÕýÈ·¡£2M µÄͼƬ¶ÁµÃ10¶àK ¡£¡£ÄÄλ´óÏÀ¿ÉÒÔ°ï°ïÎÒ°¡¡£
#!D:\ProgrammerTools\python26\python.exe
#encoding=utf-8
import cgitb
import os
cgitb.enable()
import cgi,urllib ......
>>> x=-1
>>> if x>0:
print ('11')
>>> else:
SyntaxError: invalid syntax (<pyshell#20>, line 1)
ÍøÉÏËѵÄÒ²ÊÇ£º
>>> x=int(input("Please ent ......
±ÈÈçÎÒÐèÒªÓÃpython ¶Ôwin32³ÌÐò½øÐÐÒ»¶¨µÄ¿ØÖÆ
¶ÔtextboxÊäÈëÒ»´®×Ö·û´®
°´Ä³¸öbotton
¶ÔlistboxÀïµÄµÄÄÚÈݶÁÈ¡£¬´æ³É×Ö·û´®
¸ÃÈçºÎ²Ù×÷£¿
»òÕßÄÄÀïÓÐÎĵµÀý×Ó£¿
·Ç³£¸Ðл
......
ÓÉÓÚÊdzõѧ£¬ÔÚЩÇë½Ì´ó¼Ò¡£
Python code:
from urllib import request
import struct
class csdn:
def __init__(self):
print ('Hello,this is a init')
def getContent(self,url) ......