Python Êý×ÖÓë×Ö·û´®Á¬½ÓÎÊÌâ
¶¨ÒåÏÂÃæÕâÑùÒ»¸öº¯Êý£¬½«excel±í¸ñÖÐÁ½¸öµ¥Ôª¸ñµÄÄÚÈÝÁ¬³ÉÒ»¸ö×Ö·û´®£¬µ«ÊÇÈç¹ûǰһ¸öµ¥Ôª¸ñµÄÄÚÈÝÊÇÊý×Ö£¬±ÈÈçÊÇ¡°1¡±£¬ºóÒ»¸öµ¥Ôª¸ñµÄÊÂ×Ö·û´®£¬¾Í»á±¨´íunsupported operand type(s) for +=: 'float' and 'unicode'¡£def GetSection(index):
section = sheet.cell_value(index,6)
section += sheet.cell_value(index,8)
return section
Èç¹ûÔÚ ¡°+=¡± ²Ù×÷Ç°Ãæ¼ÓÒ»¾ä str(section)
Óֻᱨ´íascii' codec can't encode character u'\u5168' in position 0: ordinal not in range(128)
ÇëÎÊÈçºÎ½â¾ö
ÀûÓÃunicode À´Ç¿ÖÆ×ª³É×Ö·û´®ÊÔÊÔ
section += unicode(sheet.cell_value(index,8))
ËäÈ»PythonÊǶ¯Ì¬ÓïÑÔ£¬µ«PythonÖеĶÔÏóÊÇÇ¿ÀàÐ͵ģ¬int Óë strÐ͵ĶÔÏóµ±È»²»ÄÜÌí¼Ó¡£
return ('%s%d' %(sheet.cell_value(index,6),sheet.cell_value(index,8)))
Õâ¸ö¿ÉÒÔ²»
Õâ¸öÓ¦¸Ã¿ÉÒÔ°É¡£²»¹ý£¬Èç¹û±àÂë²»¶ÔµÄ»°£¬»¹ÊÇ»á³öÏÖÂÒÂëµÄ¡£
ѧϰ....
³ÌÐòÖбàÂëҪͳһŶ
²»È»ÒÔºóºÜÂé·³µÄ
ÕâÊǸö±àÂëÎÊÌ⣬EXCELÀï×Ö·û´®¶¼ÊÇUNICODE£¬Êý×Ö¾ÍÊÇÊýÖµÀàÐÍ£¬Á½¸ö±äÁ¿Ïà¼Ó֮ǰ£¬½«ÊýÖµÀàÐÍÇ¿ÖÆ×ª»»ÎªUNICODEÀàÐͼ´¿É£¬¿´ÏÂÏà¹ØµÄ×ÊÁϾÍÐÐÁË
def InsertCode5(cursor,code,address,section):
t = (code,address,section,)
cursor.execute('insert into TBL_CODE_5 values (?,?,?)', t)
½â決ÁË£¬謝謝´ó¼ÒÖ§³Ö
Ïà¹ØÎÊ´ð£º
ÎÒÿ´ÎÉÏ´«µÄÎļþ¶Áµ½µÄÊý¾Ý¶¼²»ÕýÈ·¡£2M µÄͼƬ¶ÁµÃ10¶àK ¡£¡£ÄÄλ´óÏÀ¿ÉÒÔ°ï°ïÎÒ°¡¡£
#!D:\ProgrammerTools\python26\python.exe
#encoding=utf-8
import cgitb
import os
cgitb.enable()
import cgi,urllib ......
C#ÀïÃæÓÃusing System.Security.Cryptography; RSACryptoServiceProvider¼ÓÃܹýµÄÏûÏ¢
ÓÃPython CryptoÖÐRSAµÄ·½·¨ ÄÜÖ±½Ó ½âÂð£¿
RSA¼ÓÃÜ·½Ê½²»ÊÇͳһµÄÂð£¿ÐèҪעÒâЩʲô£¿
ÓаïÖú¡£µ«ÊÇû½â¾öÎÊÌâ¡£¡£¡£
......
ÈçºÎ½«PythonдµÄÒ»¶Î´úÂëÉú³ÉpydÐÎʽµÄ¿â?
ÎÒÖªµÀµÄ·½·¨ÓУº½«Õâ¶ÎPython´úÂëÀ©Õ¹³ÉC´úÂ룬Ȼºóͨ¹ýVC½«Õâ¶ÎC´úÂëÉú³Éºó׺Ϊ.pydµÄ¶¯Ì¬Á´½Ó¿â¡£
²»ÏëÓÃÕâô±¿µÄ·½·¨£¬ÇëÎÊÓÐûÓбȽϼòµ¥µÄ·½·¨£¿Ð»Ð»£¡
¶¥Ò»Ï£¬ ......
code:
remote = urllib.urlopen(remote_file)
local_file = open(local_path_name, "wb")
local_file.write(remote.read())
ÎÊÌâ:
ÓÃÕâÖÖ·½Ê½¿ÉÒԺܺõÄÏÂÔØÔ¶³ÌÎļþ, ÏÖÔÚÐèÒª¼ÓÈëÒ»¸ö½ø¶ÈÏÔʾµÄ¹¦Ä ......
תÌû£º
import sys
from wxPython.wx import *
from wxPython.lib import newevent
DispatchEvent, EVT_DISPATCH = newevent.NewEvent()
class GenericDispatchMixin:
def __init__(self):
......