[Tutor] Variable name containing '-'
Peter Otten
__peter__ at web.de
Sat Sep 2 03:45:55 EDT 2017
ramakrishna reddy wrote:
> Hi there,
>
> I am implementing a soap webservice where a method which has keyword
> parameter(named:abc-xyz) needs to be used to call third party app.
>
> eg: obj.method(abc-xyz=10)
>
> As python does not support '-' in variable names, I am a bit confused.
> I know in case of methods we can use getattr(self.object, 'method-name')()
> can be used. But in case of variable how we can use ?
There might be an official way to deal with this problem. What SOAP library
are you using? Does its documentation say something about this case?
If there is no good answer you may have to resort to the hackish
obj.method(**{"abc-xyz": 10})
More information about the Tutor
mailing list