mirror of
https://github.com/donnemartin/data-science-ipython-notebooks.git
synced 2024-03-22 13:30:56 +08:00
Updated notebook to v3.
This commit is contained in:
parent
bde82dd137
commit
2bb1b6b0d8
|
@ -1,12 +1,4 @@
|
|||
{
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"signature": "sha256:f23d7a0b01d6b36ad881c51726d1c5e72a1c2ee783560c6d984d2742ed199266"
|
||||
},
|
||||
"nbformat": 3,
|
||||
"nbformat_minor": 0,
|
||||
"worksheets": [
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
|
@ -31,19 +23,14 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"old_file_path = 'type_util.py'\n",
|
||||
"with open(old_file_path, 'r') as old_file:\n",
|
||||
" for line in old_file:\n",
|
||||
" print(line.rstrip())"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"stream": "stdout",
|
||||
"text": [
|
||||
"class TypeUtil:\n",
|
||||
"\n",
|
||||
|
@ -72,7 +59,12 @@
|
|||
]
|
||||
}
|
||||
],
|
||||
"prompt_number": 1
|
||||
"source": [
|
||||
"old_file_path = 'type_util.py'\n",
|
||||
"with open(old_file_path, 'r') as old_file:\n",
|
||||
" for line in old_file:\n",
|
||||
" print(line.rstrip())"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
|
@ -85,16 +77,16 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"new_file_path = 'hello_world.txt'\n",
|
||||
"with open(new_file_path, 'w') as new_file:\n",
|
||||
" new_file.write('hello world!')"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"prompt_number": 2
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
|
@ -105,21 +97,39 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import codecs\n",
|
||||
"with codecs.open(\"hello_world_new.txt\", \"a\", \"utf-8\") as new_file:\n",
|
||||
" with codecs.open(\"hello_world.txt\", \"r\", \"utf-8\") as old_file: \n",
|
||||
" for line in old_file:\n",
|
||||
" new_file.write(line + '\\n')"
|
||||
],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"prompt_number": 3
|
||||
}
|
||||
],
|
||||
"metadata": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 2",
|
||||
"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.9"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
}
|
Loading…
Reference in New Issue
Block a user