0

I've had no luck on google, possibly because im not sure how to word it:

>>> for k, v in a[0].__dict__.items(): s += '{}={},'.format(k, v)
>>> s
'client_id=123abc,id=123,name=name,distribution=Ubuntu,api_key=abc123,'

Now i need to pass the above information into a function:

>>> function(s)

I dont get an exception but the preset variables the function is expecting such as 'client_id' remain blank because the function is seeing one long string.

How do I get the variable to echo (string) rather than ('string')?

I hope that makes sense :)

1
  • It does not, since nothing is being echoed. Commented Feb 21, 2014 at 5:42

1 Answer 1

1

You can use ** keyword argument unpacking to pass the dictionary to the function as if they were keyword arguments:

function(**a[0].__dict__)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.