python - Escape Reserved Words for win32com -
i using win32com library python , cannot figure out how escape python reserved words used in mapi outlook. example, if try , execute following code syntax error because using word 'class'.
import win32com.client recipient = 'john smith' outlook = win32com.client.dispatch('outlook.application') namespace = outlook.getnamespace('mapi') recipient = namespace.createrecipient(recipient) resolved = recipient.resolve() sharedcalendar = namespace.getshareddefaultfolder(recipient, 9) appointments = sharedcalendar.items in range(len(appointments)): print appointments[i].class
i have tried using class_ , few other modifications still no luck.
thanks
try this:
for in range(len(appointments)): print appointments[i].class
or kratenko suggested:
for in range(len(appointments)): print getattr(appointments[i], 'class')
Comments
Post a Comment