Running your first Python program
Shashank Khandelwal edited this page Jun 15, 2014
·
13 revisions
We are going to verify that your Canopy installation worked, and are going to run your first Python program.
-
Once Canopy is installed, launch the Canopy GUI. You'll see this screen:
-
Click on "Editor"
-
Click on "Create a new file", and copy and paste in the following code:
# This uses BioPython, and is a good check to ensure that you have installed
# Enthought's Canopy correctly.
from Bio.Seq import Seq
if __name__ == '__main__':
sequence = Seq('AGTACACTGGT')
print "Here is a sequence: "
print sequence
print "And here is it's complement: "
print sequence.complement()
The file containing this program is also available here: https://github.com/khandelwal/hoya-python/blob/master/checkpython.py
- Click in the green arrow or 'play button' to run this program. The results are show in the bottom pane. You should see output very similar to the following:
%run "/tmp/tmpzJ6Guk.py"
Here is a sequence:
AGTACACTGGT
And here is it's complement:
TCATGTGACCA
Congratulations, you've run your (first) Python program!