*sorry fixed a typo - didn't stop the code from working but wanted to
make sure it was proper*def sayHello(name=None, age=None, weight=None
):
    print( "name: {name} age:{age} weight:{weight}".format(**locals()))

sayHello("Allen", 20, 150)

​

On Wed, Oct 11, 2017 at 5:49 PM, damon shelton <[email protected]>
wrote:

> I would suggest utilizing keywords rather than order - also a nice trick
> is expanding locals to keep from having to specify the keywords repeatedly
>
> def sayHello(name=None, age=None, weight=None ):
>     print( "name: {name} age:{age} weight:{weight}").format(**locals())
>
> sayHello("Allen", 20, 150)
>
> ​
>
>
>
> On Wed, Oct 11, 2017 at 5:31 PM, Simon Anderson <
> [email protected]> wrote:
>
>> missing the last close bracket
>>
>> print( "name: {0} age:{1} weight:{2}".format(sayHello))
>>
>> outputString = "name: {0} age:{1} weight:{2}".format(sayHello)
>> print( outputString )
>>
>> On Thursday, 12 October 2017 11:11:54 UTC+11, jettam wrote:
>>>
>>> Can someone help me with this string formatting.
>>>
>>> def sayHello (name=None, age=None, weight=None ):
>>>     print( "name: {0} age:{1} weight:{2}".format(sayHello)
>>>
>>> sayHello ("Allen", 20, 150)
>>>
>>>
>>> --
>> 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/ms
>> gid/python_inside_maya/d18200a5-3d0d-4497-9aab-0eb86fe6e268%
>> 40googlegroups.com
>> <https://groups.google.com/d/msgid/python_inside_maya/d18200a5-3d0d-4497-9aab-0eb86fe6e268%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/CAM9RXoLK9%2Bw-me61tM0A8uqnLM1Nk1v4FqDXDbruuaUcyt40LQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to