[Solved] creating an instance in a for loop

dir() produces a sorted list of names; these are just strings. They are not references to the actual objects. You can’t apply a call to a string. Use the globals() dictionary instead, this gives you a mapping with both the names and the actual objects: for name, obj in globals().items(): if not name.startswith(‘__’): print “name … Read more

[Solved] java dynamic class instance creation

If you need to dynamically create new objects and assign them to a variable, I would utilize a map with the key used to simulate naming a variable and the value as the newly created Chicken object: e.g. new HashMap<nameOfVariable, Chicken>() This will get you around not knowing the number or name of your instances … Read more

[Solved] How to use Alignment API to generate a Alignment Format file?

First question: I guess that the “mentioned method” is the one in tutorial1. It is not the appropriate one since you have to write a program to output the alignment format and this is a command line interface tutorial. In this case, you’d better look at http://alignapi.gforge.inria.fr/tutorial/tutorial2/index.html Then, there are basically two ways to do: … Read more