Apparently, this is a note for myself to memorize something.
- big5中文當成字串比對時,才會正確
# -*- coding: utf8 -*-
import sys reload(sys) sys.setdefaultencoding('utf-8')
- Using win's app
def eventB():
appW= subprocess.call(r'C:\Program Files\Autodesk\Maya2013\bin\maya.exe',shell=True )
- get all the drives in win
- Decryption and Encryption
def encrypt(key,content): # key,content
EncryptedData = win32com.client.Dispatch('CAPICOM.EncryptedData')
EncryptedData.Algorithm.KeyLength = 5
EncryptedData.Algorithm.Name = 2
EncryptedData.SetSecret(key)
EncryptedData.Content = content
return EncryptedData.Encrypt() def decrypt(key,content): # key,content
EncryptedData = win32com.client.Dispatch('CAPICOM.EncryptedData')
EncryptedData.Algorithm.KeyLength = 5
EncryptedData.Algorithm.Name = 2
EncryptedData.SetSecret(key)
EncryptedData.Decrypt(content)
str = EncryptedData.Content
return str
s1 = encrypt('lovebread', 'hello world')
s2 = decrypt('lovebread', s1)
print s1,s2
# MGEGCSsGAQQBgjdYA6BUMFIGCisGAQQBgjdYAwGgRDBCAgMCAAECAmYBAgFABAgq
# GpllWj9cswQQh/fnBUZ6ijwKDTH9DLZmBgQYmfaZ3VFyS/lq391oDtjlcRFGnXpx
# lG7o
# hello world
- ComboBox
def XXX(self. idx): #idx is the singal sended from the comboBox
print 'singal is:' idx
- QTreeWidget
itemList = []for fileName in os.listdir(os.path.expanduser("~/"):filePath = os.path.join(os.path.expanduser("~/"), fileName) lineCount = sum(1 for line in open(filePath))item = QtGui.QTreeWidgetItem() item.setData(0, 0, fileName) item.setData(1, 0, str(lineCount)) itemList.append(item)
沒有留言:
張貼留言