How can I extract data from a class in Python?
>>>Bio.Alphabet.RNAAlphabet
<class Bio.Alphabet.RNAAlphabet at 0x01EBF420>
How can I extract, say for example, the letters of that Alphabet from that object in Byophthon?
How can I extract data from a class in Python?
>>>Bio.Alphabet.RNAAlphabet
<class Bio.Alphabet.RNAAlphabet at 0x01EBF420>
How can I extract, say for example, the letters of that Alphabet from that object in Byophthon?
Hi,
In order to know the possible methods (functions) or attributes of an object (the data contained within that object), you should use the following Python command:
dir(object_name)
In your case, this would probably give:
dir(Bio.Alphabet.RNAAlphabet)
This will tell you what you can use or visualize in the object.
I suggest that you take some time familiarizing yourself with classes and object oriented programming in Python
EDIT:
Let's say the name of the attribute containing the data is 'letters', you can print it like this:
print Bio.Alphabet.RNAAlphabet.letters
If you don't want to print it, put it in a variable or torture it however you like :P.
Cheers
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
If this question solve your problem and your other question is redundant, please closing this other question. Cheers
If this question solved your problem and your other question is redundant, please closing this other question. Cheers