Symbolic Posted January 14, 2009 Share Posted January 14, 2009 (edited) Hi, I have been playing around with python for a while. I have the following problem. inside = self.children() will give me the list of what ever is there inside a node. hou.ui.displayMessage(str(inside[0])) will display a nice windows with the first name in the array in it. But if I just go: hou.ui.displayMessage(str(inside)) It goes creazy like: (<hou.ObjNode of type geo at /obj>,) How can I create a proper window listing node names properly? Thanks. Edited January 14, 2009 by Symbolic Quote Link to comment Share on other sites More sharing options...
graham Posted January 14, 2009 Share Posted January 14, 2009 You can do: childnames = [child.name() for child in mynode.children()] hou.ui.displayMessage("\n".join(childnames)) Quote Link to comment Share on other sites More sharing options...
Symbolic Posted January 14, 2009 Author Share Posted January 14, 2009 Thanks! That worked great! Quote Link to comment Share on other sites More sharing options...
Symbolic Posted January 14, 2009 Author Share Posted January 14, 2009 Thanks! That worked great! One small thing... what if want to add a string like "and" in between each name? I looked at ways of manipulating arrays... but could not understand it much. Thanks. Quote Link to comment Share on other sites More sharing options...
rdg Posted January 14, 2009 Share Posted January 14, 2009 One small thing... what if want to add a string like "and" in between each name? childnames = [child.name() for child in mynode.children()] hou.ui.displayMessage(" and ".join(childnames)) join() is a methoid of strings, not array/list/tuples like in other languages. Confused me for a while, too. Quote Link to comment Share on other sites More sharing options...
Symbolic Posted January 14, 2009 Author Share Posted January 14, 2009 childnames = [child.name() for child in mynode.children()] hou.ui.displayMessage(" and ".join(childnames)) join() is a methoid of strings, not array/list/tuples like in other languages. Confused me for a while, too. Ow. really confusing... Thanks for the help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.