0
是否有可能使用Python返回當前系統日曆格式?例如非格里曆日曆格式,例如泰國佛教日曆。Python:獲取系統日曆格式
是否有可能使用Python返回當前系統日曆格式?例如非格里曆日曆格式,例如泰國佛教日曆。Python:獲取系統日曆格式
在windows下...對於這種方法,您需要獲取win32api package from here,這裏有一個快速腳本來讀取保存系統默認日曆類型的註冊表項,但每個用戶都有自己的密鑰,所以你可能需要動態檢查。
This gets the iCalendarType key value which you find out more about here...
下面是一些代碼來獲取值:
import win32api
import win32con
def ReadRegistryValue(hiveKey, key, name=""):
data = typeId = None
try:
keyHandle = win32api.RegOpenKeyEx(hiveKey, key, 0, win32con.KEY_ALL_ACCESS)
data, typeId = win32api.RegQueryValueEx(keyHandle, name)
win32api.RegCloseKey(keyHandle)
except Exception, e:
print "ReadRegistryValue failed:", hiveKey, key, name, e
return "Registry Key Value is: " + data
print ReadRegistryValue(win32con.HKEY_USERS,".DEFAULT\\Control Panel\\International","iCalendarType")
現在....什麼價值是指除一(1)?我找不到任何地方,但希望這可以讓你走上正確的道路......