Àý×ÓÊÇÕâÑùµÄ:
>>> str1 = 'С¹·'
>>> str1
'С¹·'
>>> str1.encode('utf-8')
b'\xe5\xb0\x8f\xe7\x8b\x97'
>>> str2 = str1.encode('utf-8')
>>> str2
b'\xe5\xb0\x8f\xe7\x8b\x97'
ÎÒ ......
import os,sys,zipfile
teststr = open('1.txt').read()
zipFile = zipfile.ZipFile('test.zip','w')
zipFile.writestr('test.txt',teststr)
zipFile.close()
ÉÏÃæµÄ´úÂë,1.txtÀïµÄ»»ÐÐÊÇ0d0a
¿ÉÊÇдµ½zipÀïÃæµÄtest.txtµÄ»»ÐÐÈ·ÊÇ0a
Ϊʲô£¿
Îı¾Ã»Ëùν°É£¬Ñ¹ ......
ÎÒÓÃPythonдÁËÒ»¸öС½Å±¾£¬×÷ÓÃÊÇͳ¼ÆÎÒe:\downloadĿ¼ÏÂÎļþ¶¼°üº¬ÁËÄÄЩÀ©Õ¹Ãû£¬²¢´òÓ¡³öÀ´£¬µ«ÊDz»ÖªµÀΪʲô£¬Õâ¸ö½Å±¾ËäÈ»¿ÉÒÔÕý³£µÄÔËÐУ¬µ«ÊÇÔËÐеķdz£·Ç³£Âý£¬Æ½¾ùÿһ´ÎÔËÐеÄʱ¼ä¶¼³¬¹ýÁË1·ÖÖÓ²ÅÓнá¹û£¬Çë½Ìһϸ÷λÕâÊÇΪʲô£¿ÊDz»ÊÇÎҵijÌÐòÄÄÀïÉè¼ÆµÄ²»ºÏÀíµ¼Öµģ¿
±¸×¢£º
ÎÒµÄe:\downloadÄ¿Â ......
ÎÒÔÚÅú´¦ÀíÖе÷ÓÃpython½Å±¾
ÈçÏ£º
call %pyscript%\StaticResult.py -s D:\DailySDV\Bts8.1\TestLog\TestResult.xml -d %CiRoot_WndPath%\cruisecontrol\userData\groups\group01\projects\%ProjectName%\%GtrRltPath%\!GtrRltNameStr!.xml -t %CiRoot_WndPath%\cruisecontrol\userData\groups\group01\projects\%Proje ......
python
content=str.find('ok') && content=str.find('not ok')
ÕâÑù±íʾ ÔÚÄÚÈÝÖÐÕÒµ½ ok »òÕß ÕÒµ½ not ok ¶ÔÂð£¿
²¢ÁÐÌõ¼þÓà and ¶ø²»ÊÇ&&
»òÕßÌõ¼þÓà or ¶ø²»ÊÇ||
ÄãµÄÒâ˼Ӧ¸ÃÊÇor ÄãÊǶ¼´íÁË
ÕÒ±¾½Ì³Ì¿´¿´°É£¬¿ÉÒÔgoogleËÑË÷python ......
Python code:
class A:
def __init__(self):
self.B_Handle = B_Handle
self.VA = "A_init"
print "Class A init"
def __getattr__(self, name):
print "A.__getattr__"
print "name=%s" % name
def callref(sel ......
×ܼǼÊý:175; ×ÜÒ³Êý:30; ÿҳ6 Ìõ;
Ê×Ò³ ÉÏÒ»Ò³ [1] [2] [3] [4] 5
[6] [7] [8] [9] [10] ÏÂÒ»Ò³ βҳ