Updated notebook to v3.

This commit is contained in:
Donne Martin 2015-05-14 06:55:23 -04:00
parent bde82dd137
commit 2bb1b6b0d8

View File

@ -1,12 +1,4 @@
{ {
"metadata": {
"name": "",
"signature": "sha256:f23d7a0b01d6b36ad881c51726d1c5e72a1c2ee783560c6d984d2742ed199266"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -31,19 +23,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"collapsed": false, "execution_count": 1,
"input": [ "metadata": {
"old_file_path = 'type_util.py'\n", "collapsed": false
"with open(old_file_path, 'r') as old_file:\n", },
" for line in old_file:\n",
" print(line.rstrip())"
],
"language": "python",
"metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout",
"output_type": "stream", "output_type": "stream",
"stream": "stdout",
"text": [ "text": [
"class TypeUtil:\n", "class TypeUtil:\n",
"\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", "cell_type": "markdown",
@ -85,16 +77,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"collapsed": false, "execution_count": 2,
"input": [ "metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"new_file_path = 'hello_world.txt'\n", "new_file_path = 'hello_world.txt'\n",
"with open(new_file_path, 'w') as new_file:\n", "with open(new_file_path, 'w') as new_file:\n",
" new_file.write('hello world!')" " new_file.write('hello world!')"
], ]
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@ -105,21 +97,39 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"collapsed": false, "execution_count": 3,
"input": [ "metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import codecs\n", "import codecs\n",
"with codecs.open(\"hello_world_new.txt\", \"a\", \"utf-8\") as new_file:\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", " with codecs.open(\"hello_world.txt\", \"r\", \"utf-8\") as old_file: \n",
" for line in old_file:\n", " for line in old_file:\n",
" new_file.write(line + '\\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
} }