Try this.

myDic = {'config_type': u'high', 'config_path': u'C:\somePath'}
def foo(config_type='high', config_path='C:\somePath'):
    print(config_type, config_path)

foo(**myDic)# Result: (u'high', u'C:\\somePath')
def foo(**kwargs):
    print(kwargs)

foo(**myDic)# Result: {'config_type': u'high', 'config_path': u'C:\\somePath'}

​

On 4 May 2017 at 12:21, Rudi Hammad <[email protected]> wrote:

> Hi,
>  I am trying to do the following
> Let´s say that I have a dictionary like this
>
> myDic = {'config_type': u'high', 'config_path': u'C:\somePath'}
>
> I want to create a function that will execute the following the dictionary
> items as parameters
>
> def foo('config_type'= 'high', 'config_path': 'C:\somePath')
>
> I can´t figure out how to do this.
> myDic will keep changing all the time, and I want to extract each time the
> items as parameters and execute the function
> as explained above. The examples that I´ve read with **kwargs I am not
> sure if they apply here.
>
> thank you
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/30e22783-2e38-404e-8243-
> 50a8d8126be2%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/30e22783-2e38-404e-8243-50a8d8126be2%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCyyyyvfTNZa8-xBU0d-BDS8YzzY2fWft7S0YKWFDu2fw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to