[Tutor] quick function variable
Nathan Smith
nathan-tech at hotmail.com
Tue Feb 8 21:22:40 EST 2022
Hi!
As Cameron mentioned the end solution was:
d={'name': 'bob'}
func(**d)
thanks a lot :)
Nathan
On 09/02/2022 00:54, Alan Gauld via Tutor wrote:
> On 09/02/2022 00:02, Nathan Smith wrote:
>
>> def func(name="bob", lastname="bobland", chicken="soup"):
>> How could I do this in variables?
>>
>> EG:
>>
>> variable_change="name"
>> value="Bob"
>> func(variable_change=value)
> I have no idea!
> but I suspect if there is a way, the answer might lie in
> the functools module, so that might be worthy of some study.
>
> Just a guess!
>
--
Best Wishes,
Nathan Smith, BSC
My Website: https://nathantech.net
More information about the Tutor
mailing list