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)
½â決ÁË£¬謝謝´ó¼ÒÖ§³Ö
Ïà¹ØÎÊ´ð£º
ÔÚlistÖÐÌí¼ÓÒ»¸öÀàµÄ¾Ö²¿±äÁ¿ ÕâÑù×öÊÇ·ñºÏ·¨ Çë¿´ÏÂÃæÀý×Ó:
Python code:
class A():
def __init__( self ):
self.__a = 0
self.__b = 'hello'
def get_a( self ):
ret ......
ѧϰpythonµÄ7±¾Êé
°üÀ¨6±¾chm£¬Ò»±¾pdf×ÊÁÏ
¶ÔѧϰpythonÓкܴóµÄ°ïÖú
http://download.csdn.net/source/619791
¾«ÐÄËѼ¯£¬²»Òª»ý·Ö£¬ÄóöÀ´·ÖÏí
лл¥Ö÷£¬ÐÁ¿àÁË~
lz ×îºÃ°ÑÊéÃûºÍ¼òµ¥½éÉܼÓÉ ......
#! c:\python26
# Filename: backup_ver1.py
import os
import time
source=[r'C:\test', r'C:\test1']
target_dir='D:\\back\\'
target=target_dir+time.strftime('%Y%m%d%H%M%S')+'.zip'
zip_command=" ......
C++Öе÷ÓÃpythonº¯Êý£¬·¢ÏÖpythonº¯ÊýµÄÒì³£ÔÚC++ÖÐÎÞ·¨²¶»ñ¡£
µ÷Óú¯ÊýÈçÏ£¬Çë´óÏÀ½â»ó
unsigned long CPythonHelper::Execute(const std::string& mml_cmd,
u ......
ѧϰPyQt£¬·¢ÏÖÆäÖÐÒ»¶Î½Å±¾ÊÇÕâÑùµÄ£º
class Form(QDialog):
........
amountLabel = QLabel("Amount")
self.amountLabel = QLabel()
........
pythonÖеÄÀàÖ ......