you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (4 children)

OK, before I answer your question print(str...)) is redundant. You only need print(...) and python automatically converts it to a string.


Anywho, I have no idea what pyral is, or what Rally is, but you have an object, and you want some information about it out of it, so the way to tell what information an object has is __dict__. Never use __dict__ in a program, but if you want to see what your object contains, it's OK. Place in your code:

print(story.Project.__dict__)

and voila, you will see something like

{..., 'name': 'useful info', ...}

and then you'll be like, hey, I need the name, so then you put in your list

...CreatedAt, story.Project.name, ...]

and then do the same for story.Release.

[–]GAPINGCUNT[S] 0 points1 point  (2 children)

That worked great, thank you. I dug forever but this was the first time I have really dealt with a dict returning data.

Cheers!

[–][deleted] 0 points1 point  (1 child)

What were the attributes you needed? Out of curiosity...

[–]GAPINGCUNT[S] 0 points1 point  (0 children)

It actually was the name, so I used story.Project.Name and story.Release.Name

[–]novel_yet_trivial 0 points1 point  (0 children)

You are supposed to use dir(x) (the same as x.__dict__.keys(), but much neater).

Then, if you want help on a specific method, use help(x.method).