python»ù´¡ÎÊÌ⣬Çë½Ì¸ßÊÖ¡£
ÇëÎʸßÊÖ£¬ÎÒÓõÄÊÇpythonwin2.5µÄ°æ±¾£¬ÔÚ¿ª·¢µÄ¹ý³ÌÖÐÓöµ½ÁËÏÔʾÖÐÎÄÂÒÂëµÄÎÊÌâºÜÍ·ÌÛ£¬Çë¸ßÊִͽ̡£
¼òµ¥µÄ´úÂëÈçÏ£¬±£´æµÄÎļþÃûÊÇÓ¢Îĵģ¬ÎÒÊÇÓÃpythonwinн¨µÄ½Å±¾£¬±£´æµÄʱºòÑ¡ÏîÀïûÓбàÂëÑ¡ÏÔËÐкóÏÔʾÂÒÂ룺\xc0\xad\xb6\xfb\xb7\xf2 ', '\xc4\xd0 ', '2585652265'), ('\xb2\xbb\xd6\xaa\xbb\xf0\xce\xe8 ', '\xc5\xae ', '2652230225'), ('\xb0\xcb\xc9\xf1 ', '\xc4\xd0 ', '5552326525')
ÓÚÊÇÎÒÓüÇʱ¾ÓÖÖØб£´æ£¬²¢ÇÒÎļþ±àÂë±£´æÊÇutf-8£¬µ«»¹ÊÇÂÒÂ룿£¿Êý¾Ý¿âÎÒÓõÄÊÇsqlserverµÄÊý¾Ý¿â£¬Âé·³Çë¸æÖª¡£
ÁíÍ⣬ÎÒ»¹ÏëÎÊһϣ¬Èç¹û°ÑÔ´´úÂëÎļþ¿ª·¢µ½Ó²Å̵ĸùĿ¼Ï£¬±ÈÈçd:\,ÔÚÈçºÎµ÷ÓôËÎļþ£¬ÓÃfrom import ÈçºÎµ¼È룿£¿
# -*- coding:utf-8 -*-
import Tkinter
import odbc
con=odbc.odbc('one')
cursor=con.cursor()
cursor.execute('select * from student')
r=cursor.fetchall()
root=Tkinter.Tk()
Label=Tkinter.Label(root,text=r)
Label.pack()
root.mainloop()
ÓÃtkµÄ»°£¬Ò»°ã×Ö´®Òªutf±àÂ룬»òÕßunicode×Ö´®¡£ÄãµÄ×ÊÁÏÓ¦¸ÃÊÇgbkµÄ£¬Òªobj.decode('gbk')»òunicode(obj,'gbk')ת»¯³Éunicode×Ö´®¡£
\xc0\xad\xb6\xfb\xb7\xf2 ÏÔʾµÄÕâЩ¶«Î÷Ó¦¸Ã²»ÊÇÂÒÂë...¿ÉÒÔʹÓÃÖض¨Ïò, ÊäÈëµ½ÎļþÊÔÊÔ, ÈçÏÂ:
f
Ïà¹ØÎÊ´ð£º
ÎÒÏÖÔÚÊÇÕâÑùµÄ
¿ªÁËÒ»¸ö×ÓỊ̈߳¬¶ÁÈ¡ÏÂÃæµÄÏûÏ¢
±¾ÒâÊÇ
Python code:
while not self._stopevent.isSet( ):
re=¶ÁȡϲãÏûÏ¢
if re>0:
´¦Àí
else:
pass
¼ÙÈ ......
pythonºÍpyqtÒÔ¼°Eric4¶¼ÒѾÅäÖúÃÁË£¬´ò¿ªEric4д¸öpython³ÌÐò±ÈÈç¼òµ¥µÄ
print¡°hello£¬world¡±£¬Ôõô±àÒëÔËÐÐÁË£¬Start²Ëµ¥µÄËùÓÐÃüÁ³öÏÖºÍͼÖв¶àµÄ¶Ô»°¿ò£¬Ó¦µ±ÔõôÔËÐÐÁË£¿
Çó´ó¼ÒÖ¸½Ì
ûÓÐÈËÓà ......
ÒÑÖªPython ÖУº
s = unicode("²âÊÔ", "gb2312")
s = u'\u6d4b\u8bd5'
print s
²âÊÔ
ÔÚDelphiÀïÃæÈçºÎ½«\u6d4b\u8bd5ÕâÑùµÄ»¹Ô³ÉGb2312µÄºº×ÖÄØ£¿
ÕÒµ½¸ö·½·¨
......
s='aaa111aaa,bbb222,333ccc,444ddd444,555eee666,fff777ggg'
ÓÃÕýÔò±í´ïʽȡ³ö Ç°ºó×ÖĸÏàͬµÄÊý¾Ý ½á¹ûÈçÏÂ:
111 ddd
лл~
Python code:
import re
s='aaa111aaa,bbb222,333ccc,444ddd444,555eee666,ff ......
ÏëÎÊÁ½¸öÎÊÌ⣺
1¡¢Python¼ÈÈ»ÊǹéÊôÓڽű¾ÓïÑÔ£¬ÄÇôÔÚʲôƽ̨ÏÂÔËÐУ¿
£¨vb script£¬JAVA script£¬php¶¼ÊôÓڽű¾ÓïÑÔÖÖÀ࣬¶¼ÊÇÓÃÓÚÍøÒ³½Å±¾£¬ÄÇôPythonͨ³£ÓÃÔÚÄÄÀïÄØ£¿£©
2¡¢PythonÄÜ·ñÔÚÈû°àV3°æ±¾Ï ......