Bo Zhang (NAOC, mailto:bozhang@nao.cas.cn) will have a few lessons on python.
python
to process astronomical data.These lectures are organized as below:
python
?Often, programmers fall in love with Python because of the increased productivity it provides. Since there is no compilation step, the edit-test-debug cycle is incredibly fast. Debugging Python programs is easy: a bug or bad input will never cause a segmentation fault. Instead, when the interpreter discovers an error, it raises an exception. When the program doesn't catch the exception, the interpreter prints a stack trace. A source level debugger allows inspection of local and global variables, evaluation of arbitrary expressions, setting breakpoints, stepping through the code a line at a time, and so on. The debugger is written in Python itself, testifying to Python's introspective power. On the other hand, often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective.
reference: https://www.python.org/doc/essays/blurb/
comparison with some other programming languages: https://www.python.org/doc/essays/comparisons/
python
python
packages
python
via $ sudo apt-get install python
pip
via getpip.pyPS: $ sudo apt-get install python-pip
is not recommended
pip
can install almost all python
packages.
So I recommend you use this to install all packages.
An alternative is to use easy_install
, a very similar tool.
type $ python
to enter the python
shell
In [1]:
print "Hello World"
spyder / python(x,y) / WinPython(windows only)
jupyter console / qtconsole (ipython / ipython qtconsole)
jupyter notebook (ipython notebook)
In [2]:
%magic
In [3]:
%%bash
ls -a
In [ ]:
In [4]:
from IPython.core.display import HTML
def css_styling():
styles = open("../styles/custom_ppbmh_modified.css", "r").read()
return HTML(styles)
css_styling()
Out[4]:
In [ ]: