开发者

get dbus.Struct properties

开发者 https://www.devze.com 2023-02-16 08:09 出处:网络
I\'m trying to write a notification script using python-dbus. How can I get properties from a dbus.Struct object?

I'm trying to write a notification script using python-dbus. How can I get properties from a dbus.Struct object? For example if I print it out as string, it is dbus.Struct((dbus.String(u'msg_s开发者_StackOverflow社区ubject:Re: email subject'),), signature=None) I need to get the inner string.


Looks like dbus.Struct inherits from tuple, so you should be able to do this:

>>> msg = dbus.Struct((dbus.String(u'msg_subject:Re: email subject'),), signature=None)
>>> msg[0]
dbus.String(u'msg_subject:Re: email subject')
0

精彩评论

暂无评论...
验证码 换一张
取 消