Вы находитесь на странице: 1из 7

{

"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Python Version"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2.7.12\n"
]
}
],
"source": [
"# Check Python version\n",
"import platform\n",
" \n",
"print(platform.python_version())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Current Library"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"u'C:\\\\Shay\\\\Personal\\\\Colman\\\\DataScience\\\\ShayNotebooks'"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pwd"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Notebook Cells\n",
"\n",
"show how to insert cells above/below\n",
"\n",
"show the difference between CODE and MARKDOWN cells\n",
"\n",
"show how to write a new cell\n",
"\n",
"show how to delete a cell\n",
"\n",
"SHIFT+ENTER to run a cell\n",
"\n",
"MENU Cell>Run All to run all cells\n",
"\n",
"MENU Kernel - Restart - to restart the kernel\n"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hello\n"
]
}
],
"source": [
"print 'hello'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Shortcuts"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"\n",
"l = [1,2,3]\n"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (<ipython-input-43-1a946c9dc09c>, line 2)",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<ipython-input-43-
1a946c9dc09c>\"\u001b[0;36m, line \u001b[0;32m2\u001b[0m\n\u001b[0;31m
l.\u001b[0m\n\u001b[0m
^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid
syntax\n"
]
}
],
"source": [
"print 'TAB will show a pop up of methods of an object'\n",
"l."
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"SHIFT+Tab will show an expanded view of a method - a docstring!\n"
]
},
{
"data": {
"text/plain": [
"<function append>"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print 'SHIFT+Tab will show an expanded view of a method - a docstring!'\n",
"l.append"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Help on list object:\n",
"\n",
"class list(object)\n",
" | list() -> new empty list\n",
" | list(iterable) -> new list initialized from iterable's items\n",
" | \n",
" | Methods defined here:\n",
" | \n",
" | __add__(...)\n",
" | x.__add__(y) <==> x+y\n",
" | \n",
" | __contains__(...)\n",
" | x.__contains__(y) <==> y in x\n",
" | \n",
" | __delitem__(...)\n",
" | x.__delitem__(y) <==> del x[y]\n",
" | \n",
" | __delslice__(...)\n",
" | x.__delslice__(i, j) <==> del x[i:j]\n",
" | \n",
" | Use of negative indices is not supported.\n",
" | \n",
" | __eq__(...)\n",
" | x.__eq__(y) <==> x==y\n",
" | \n",
" | __ge__(...)\n",
" | x.__ge__(y) <==> x>=y\n",
" | \n",
" | __getattribute__(...)\n",
" | x.__getattribute__('name') <==> x.name\n",
" | \n",
" | __getitem__(...)\n",
" | x.__getitem__(y) <==> x[y]\n",
" | \n",
" | __getslice__(...)\n",
" | x.__getslice__(i, j) <==> x[i:j]\n",
" | \n",
" | Use of negative indices is not supported.\n",
" | \n",
" | __gt__(...)\n",
" | x.__gt__(y) <==> x>y\n",
" | \n",
" | __iadd__(...)\n",
" | x.__iadd__(y) <==> x+=y\n",
" | \n",
" | __imul__(...)\n",
" | x.__imul__(y) <==> x*=y\n",
" | \n",
" | __init__(...)\n",
" | x.__init__(...) initializes x; see help(type(x)) for signature\n",
" | \n",
" | __iter__(...)\n",
" | x.__iter__() <==> iter(x)\n",
" | \n",
" | __le__(...)\n",
" | x.__le__(y) <==> x<=y\n",
" | \n",
" | __len__(...)\n",
" | x.__len__() <==> len(x)\n",
" | \n",
" | __lt__(...)\n",
" | x.__lt__(y) <==> x<y\n",
" | \n",
" | __mul__(...)\n",
" | x.__mul__(n) <==> x*n\n",
" | \n",
" | __ne__(...)\n",
" | x.__ne__(y) <==> x!=y\n",
" | \n",
" | __repr__(...)\n",
" | x.__repr__() <==> repr(x)\n",
" | \n",
" | __reversed__(...)\n",
" | L.__reversed__() -- return a reverse iterator over the list\n",
" | \n",
" | __rmul__(...)\n",
" | x.__rmul__(n) <==> n*x\n",
" | \n",
" | __setitem__(...)\n",
" | x.__setitem__(i, y) <==> x[i]=y\n",
" | \n",
" | __setslice__(...)\n",
" | x.__setslice__(i, j, y) <==> x[i:j]=y\n",
" | \n",
" | Use of negative indices is not supported.\n",
" | \n",
" | __sizeof__(...)\n",
" | L.__sizeof__() -- size of L in memory, in bytes\n",
" | \n",
" | append(...)\n",
" | L.append(object) -- append object to end\n",
" | \n",
" | count(...)\n",
" | L.count(value) -> integer -- return number of occurrences of
value\n",
" | \n",
" | extend(...)\n",
" | L.extend(iterable) -- extend list by appending elements from the
iterable\n",
" | \n",
" | index(...)\n",
" | L.index(value, [start, [stop]]) -> integer -- return first index of
value.\n",
" | Raises ValueError if the value is not present.\n",
" | \n",
" | insert(...)\n",
" | L.insert(index, object) -- insert object before index\n",
" | \n",
" | pop(...)\n",
" | L.pop([index]) -> item -- remove and return item at index (default
last).\n",
" | Raises IndexError if list is empty or index is out of range.\n",
" | \n",
" | remove(...)\n",
" | L.remove(value) -- remove first occurrence of value.\n",
" | Raises ValueError if the value is not present.\n",
" | \n",
" | reverse(...)\n",
" | L.reverse() -- reverse *IN PLACE*\n",
" | \n",
" | sort(...)\n",
" | L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN
PLACE*;\n",
" | cmp(x, y) -> -1, 0, 1\n",
" | \n",
" |
----------------------------------------------------------------------\n",
" | Data and other attributes defined here:\n",
" | \n",
" | __hash__ = None\n",
" | \n",
" | __new__ = <built-in method __new__ of type object>\n",
" | T.__new__(S, ...) -> a new object with type S, a subtype of T\n",
"\n"
]
}
],
"source": [
"help(l)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# single line comment"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"''' multiple\n",
"line\n",
"comment '''"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.12"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

Вам также может понравиться