You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
452 lines
16 KiB
Plaintext
452 lines
16 KiB
Plaintext
4 years ago
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
4 years ago
|
"execution_count": 1,
|
||
4 years ago
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"quilt = [\n",
|
||
4 years ago
|
"[\"2-louisa-final\",\"Camilo\",\"newest patch_floor_rain\",\"jacopo.otherness.def\"],\n",
|
||
|
"[\"kendalpatch\",\"euna\", \"patchericoforthefuture\",\"punctuationflag\"],\n",
|
||
|
"[\"euna\",\"punctuationflag\",\"euna\",\"patchericoforthefuture\"],\n",
|
||
|
"[\"2-louisa-final\",\"MARTIN_GRADIENTENSE\", \"jacopo.otherness.def\",\"kendalpatch\"],\n",
|
||
4 years ago
|
"]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
4 years ago
|
"execution_count": 2,
|
||
4 years ago
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
4 years ago
|
"[['2-louisa-final',\n",
|
||
|
" 'Camilo',\n",
|
||
|
" 'newest patch_floor_rain',\n",
|
||
|
" 'jacopo.otherness.def'],\n",
|
||
|
" ['kendalpatch', 'euna', 'patchericoforthefuture', 'punctuationflag'],\n",
|
||
|
" ['euna', 'punctuationflag', 'euna', 'patchericoforthefuture'],\n",
|
||
|
" ['2-louisa-final',\n",
|
||
|
" 'MARTIN_GRADIENTENSE',\n",
|
||
|
" 'jacopo.otherness.def',\n",
|
||
|
" 'kendalpatch']]"
|
||
4 years ago
|
]
|
||
|
},
|
||
4 years ago
|
"execution_count": 2,
|
||
4 years ago
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"quilt"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
4 years ago
|
"execution_count": 6,
|
||
4 years ago
|
"metadata": {
|
||
4 years ago
|
"scrolled": true
|
||
4 years ago
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
4 years ago
|
"line 0 2-louisa-final\n",
|
||
4 years ago
|
"line 0 Camilo\n",
|
||
4 years ago
|
"line 0 newest patch_floor_rain\n",
|
||
|
"line 0 jacopo.otherness.def\n",
|
||
|
"line 1 2-louisa-final\n",
|
||
4 years ago
|
"line 1 Camilo\n",
|
||
4 years ago
|
"line 1 newest patch_floor_rain\n",
|
||
|
"line 1 jacopo.otherness.def\n",
|
||
|
"line 2 2-louisa-final\n",
|
||
4 years ago
|
"line 2 Camilo\n",
|
||
4 years ago
|
"line 2 newest patch_floor_rain\n",
|
||
|
"line 2 jacopo.otherness.def\n",
|
||
|
"line 3 2-louisa-final\n",
|
||
4 years ago
|
"line 3 Camilo\n",
|
||
4 years ago
|
"line 3 newest patch_floor_rain\n",
|
||
|
"line 3 jacopo.otherness.def\n",
|
||
|
"line 4 2-louisa-final\n",
|
||
4 years ago
|
"line 4 Camilo\n",
|
||
4 years ago
|
"line 4 newest patch_floor_rain\n",
|
||
|
"line 4 jacopo.otherness.def\n",
|
||
|
"line 5 2-louisa-final\n",
|
||
4 years ago
|
"line 5 Camilo\n",
|
||
4 years ago
|
"line 5 newest patch_floor_rain\n",
|
||
|
"line 5 jacopo.otherness.def\n",
|
||
|
"line 6 2-louisa-final\n",
|
||
4 years ago
|
"line 6 Camilo\n",
|
||
4 years ago
|
"line 6 newest patch_floor_rain\n",
|
||
|
"line 6 jacopo.otherness.def\n",
|
||
|
"line 7 2-louisa-final\n",
|
||
4 years ago
|
"line 7 Camilo\n",
|
||
4 years ago
|
"line 7 newest patch_floor_rain\n",
|
||
|
"line 7 jacopo.otherness.def\n",
|
||
|
"line 8 2-louisa-final\n",
|
||
4 years ago
|
"line 8 Camilo\n",
|
||
4 years ago
|
"line 8 newest patch_floor_rain\n",
|
||
|
"line 8 jacopo.otherness.def\n",
|
||
|
"line 9 2-louisa-final\n",
|
||
4 years ago
|
"line 9 Camilo\n",
|
||
4 years ago
|
"line 9 newest patch_floor_rain\n",
|
||
|
"line 9 jacopo.otherness.def\n",
|
||
|
"line 10 2-louisa-final\n",
|
||
4 years ago
|
"line 10 Camilo\n",
|
||
4 years ago
|
"line 10 newest patch_floor_rain\n",
|
||
|
"line 10 jacopo.otherness.def\n",
|
||
|
"line 11 2-louisa-final\n",
|
||
4 years ago
|
"line 11 Camilo\n",
|
||
4 years ago
|
"line 11 newest patch_floor_rain\n",
|
||
|
"line 11 jacopo.otherness.def\n",
|
||
|
"line 12 2-louisa-final\n",
|
||
4 years ago
|
"line 12 Camilo\n",
|
||
4 years ago
|
"line 12 newest patch_floor_rain\n",
|
||
|
"line 12 jacopo.otherness.def\n",
|
||
|
"line 13 2-louisa-final\n",
|
||
4 years ago
|
"line 13 Camilo\n",
|
||
4 years ago
|
"line 13 newest patch_floor_rain\n",
|
||
|
"line 13 jacopo.otherness.def\n",
|
||
|
"line 14 2-louisa-final\n",
|
||
4 years ago
|
"line 14 Camilo\n",
|
||
4 years ago
|
"line 14 newest patch_floor_rain\n",
|
||
|
"line 14 jacopo.otherness.def\n",
|
||
|
"line 15 2-louisa-final\n",
|
||
4 years ago
|
"line 15 Camilo\n",
|
||
4 years ago
|
"line 15 newest patch_floor_rain\n",
|
||
|
"line 15 jacopo.otherness.def\n",
|
||
|
"line 16 2-louisa-final\n",
|
||
4 years ago
|
"line 16 Camilo\n",
|
||
4 years ago
|
"line 16 newest patch_floor_rain\n",
|
||
|
"line 16 jacopo.otherness.def\n",
|
||
|
"line 17 2-louisa-final\n",
|
||
4 years ago
|
"line 17 Camilo\n",
|
||
4 years ago
|
"line 17 newest patch_floor_rain\n",
|
||
|
"line 17 jacopo.otherness.def\n",
|
||
|
"line 18 2-louisa-final\n",
|
||
4 years ago
|
"line 18 Camilo\n",
|
||
4 years ago
|
"line 18 newest patch_floor_rain\n",
|
||
|
"line 18 jacopo.otherness.def\n",
|
||
|
"line 19 2-louisa-final\n",
|
||
4 years ago
|
"line 19 Camilo\n",
|
||
4 years ago
|
"line 19 newest patch_floor_rain\n",
|
||
|
"line 19 jacopo.otherness.def\n",
|
||
|
"line 20 2-louisa-final\n",
|
||
4 years ago
|
"line 20 Camilo\n",
|
||
4 years ago
|
"line 20 newest patch_floor_rain\n",
|
||
|
"line 20 jacopo.otherness.def\n",
|
||
|
"line 21 2-louisa-final\n",
|
||
4 years ago
|
"line 21 Camilo\n",
|
||
4 years ago
|
"line 21 newest patch_floor_rain\n",
|
||
|
"line 21 jacopo.otherness.def\n",
|
||
|
"line 22 2-louisa-final\n",
|
||
4 years ago
|
"line 22 Camilo\n",
|
||
4 years ago
|
"line 22 newest patch_floor_rain\n",
|
||
|
"line 22 jacopo.otherness.def\n",
|
||
|
"line 23 2-louisa-final\n",
|
||
4 years ago
|
"line 23 Camilo\n",
|
||
4 years ago
|
"line 23 newest patch_floor_rain\n",
|
||
|
"line 23 jacopo.otherness.def\n",
|
||
|
"line 24 2-louisa-final\n",
|
||
4 years ago
|
"line 24 Camilo\n",
|
||
4 years ago
|
"line 24 newest patch_floor_rain\n",
|
||
|
"line 24 jacopo.otherness.def\n",
|
||
|
"line 25 2-louisa-final\n",
|
||
4 years ago
|
"line 25 Camilo\n",
|
||
4 years ago
|
"line 25 newest patch_floor_rain\n",
|
||
|
"line 25 jacopo.otherness.def\n",
|
||
|
"line 26 2-louisa-final\n",
|
||
4 years ago
|
"line 26 Camilo\n",
|
||
4 years ago
|
"line 26 newest patch_floor_rain\n",
|
||
|
"line 26 jacopo.otherness.def\n",
|
||
|
"line 27 2-louisa-final\n",
|
||
4 years ago
|
"line 27 Camilo\n",
|
||
4 years ago
|
"line 27 newest patch_floor_rain\n",
|
||
|
"line 27 jacopo.otherness.def\n",
|
||
|
"line 28 2-louisa-final\n",
|
||
4 years ago
|
"line 28 Camilo\n",
|
||
4 years ago
|
"line 28 newest patch_floor_rain\n",
|
||
|
"line 28 jacopo.otherness.def\n",
|
||
|
"line 29 2-louisa-final\n",
|
||
4 years ago
|
"line 29 Camilo\n",
|
||
4 years ago
|
"line 29 newest patch_floor_rain\n",
|
||
|
"line 29 jacopo.otherness.def\n",
|
||
|
"line 30 2-louisa-final\n",
|
||
4 years ago
|
"line 30 Camilo\n",
|
||
4 years ago
|
"line 30 newest patch_floor_rain\n",
|
||
|
"line 30 jacopo.otherness.def\n",
|
||
|
"line 31 2-louisa-final\n",
|
||
4 years ago
|
"line 31 Camilo\n",
|
||
4 years ago
|
"line 31 newest patch_floor_rain\n",
|
||
|
"line 31 jacopo.otherness.def\n",
|
||
|
"line 32 2-louisa-final\n",
|
||
4 years ago
|
"line 32 Camilo\n",
|
||
4 years ago
|
"line 32 newest patch_floor_rain\n",
|
||
|
"line 32 jacopo.otherness.def\n",
|
||
|
"line 33 2-louisa-final\n",
|
||
4 years ago
|
"line 33 Camilo\n",
|
||
4 years ago
|
"line 33 newest patch_floor_rain\n",
|
||
|
"line 33 jacopo.otherness.def\n",
|
||
|
"line 34 2-louisa-final\n",
|
||
4 years ago
|
"line 34 Camilo\n",
|
||
4 years ago
|
"line 34 newest patch_floor_rain\n",
|
||
|
"line 34 jacopo.otherness.def\n",
|
||
|
"line 35 2-louisa-final\n",
|
||
4 years ago
|
"line 35 Camilo\n",
|
||
4 years ago
|
"line 35 newest patch_floor_rain\n",
|
||
|
"line 35 jacopo.otherness.def\n",
|
||
|
"line 36 2-louisa-final\n",
|
||
4 years ago
|
"line 36 Camilo\n",
|
||
4 years ago
|
"line 36 newest patch_floor_rain\n",
|
||
|
"line 36 jacopo.otherness.def\n",
|
||
|
"line 37 2-louisa-final\n",
|
||
4 years ago
|
"line 37 Camilo\n",
|
||
4 years ago
|
"line 37 newest patch_floor_rain\n",
|
||
|
"line 37 jacopo.otherness.def\n",
|
||
|
"line 38 2-louisa-final\n",
|
||
4 years ago
|
"line 38 Camilo\n",
|
||
4 years ago
|
"line 38 newest patch_floor_rain\n",
|
||
|
"line 38 jacopo.otherness.def\n",
|
||
|
"line 39 2-louisa-final\n",
|
||
4 years ago
|
"line 39 Camilo\n",
|
||
4 years ago
|
"line 39 newest patch_floor_rain\n",
|
||
|
"line 39 jacopo.otherness.def\n",
|
||
|
"line 40 2-louisa-final\n",
|
||
4 years ago
|
"line 40 Camilo\n",
|
||
4 years ago
|
"line 40 newest patch_floor_rain\n",
|
||
|
"line 40 jacopo.otherness.def\n",
|
||
|
"line 41 2-louisa-final\n",
|
||
4 years ago
|
"line 41 Camilo\n",
|
||
4 years ago
|
"line 41 newest patch_floor_rain\n",
|
||
|
"line 41 jacopo.otherness.def\n",
|
||
|
"line 42 2-louisa-final\n",
|
||
4 years ago
|
"line 42 Camilo\n",
|
||
4 years ago
|
"line 42 newest patch_floor_rain\n",
|
||
|
"line 42 jacopo.otherness.def\n",
|
||
|
"line 43 2-louisa-final\n",
|
||
4 years ago
|
"line 43 Camilo\n",
|
||
4 years ago
|
"line 43 newest patch_floor_rain\n",
|
||
|
"line 43 jacopo.otherness.def\n",
|
||
|
"line 44 2-louisa-final\n",
|
||
4 years ago
|
"line 44 Camilo\n",
|
||
4 years ago
|
"line 44 newest patch_floor_rain\n",
|
||
|
"line 44 jacopo.otherness.def\n",
|
||
|
"line 45 2-louisa-final\n",
|
||
4 years ago
|
"line 45 Camilo\n",
|
||
4 years ago
|
"line 45 newest patch_floor_rain\n",
|
||
|
"line 45 jacopo.otherness.def\n",
|
||
|
"line 46 2-louisa-final\n",
|
||
4 years ago
|
"line 46 Camilo\n",
|
||
4 years ago
|
"line 46 newest patch_floor_rain\n",
|
||
|
"line 46 jacopo.otherness.def\n",
|
||
|
"line 47 2-louisa-final\n",
|
||
4 years ago
|
"line 47 Camilo\n",
|
||
4 years ago
|
"line 47 newest patch_floor_rain\n",
|
||
|
"line 47 jacopo.otherness.def\n",
|
||
|
"line 48 2-louisa-final\n",
|
||
4 years ago
|
"line 48 Camilo\n",
|
||
4 years ago
|
"line 48 newest patch_floor_rain\n",
|
||
|
"line 48 jacopo.otherness.def\n",
|
||
|
"line 49 2-louisa-final\n",
|
||
4 years ago
|
"line 49 Camilo\n",
|
||
4 years ago
|
"line 49 newest patch_floor_rain\n",
|
||
|
"line 49 jacopo.otherness.def\n",
|
||
|
"line 50 2-louisa-final\n",
|
||
4 years ago
|
"line 50 Camilo\n",
|
||
4 years ago
|
"line 50 newest patch_floor_rain\n",
|
||
|
"line 50 jacopo.otherness.def\n",
|
||
|
"line 51 2-louisa-final\n",
|
||
4 years ago
|
"line 51 Camilo\n",
|
||
4 years ago
|
"line 51 newest patch_floor_rain\n",
|
||
|
"line 51 jacopo.otherness.def\n",
|
||
|
"line 52 2-louisa-final\n",
|
||
4 years ago
|
"line 52 Camilo\n",
|
||
4 years ago
|
"line 52 newest patch_floor_rain\n",
|
||
|
"line 52 jacopo.otherness.def\n",
|
||
|
"line 53 2-louisa-final\n",
|
||
4 years ago
|
"line 53 Camilo\n",
|
||
4 years ago
|
"line 53 newest patch_floor_rain\n",
|
||
|
"line 53 jacopo.otherness.def\n",
|
||
|
"line 54 2-louisa-final\n",
|
||
4 years ago
|
"line 54 Camilo\n",
|
||
4 years ago
|
"line 54 newest patch_floor_rain\n",
|
||
|
"line 54 jacopo.otherness.def\n",
|
||
|
"line 55 2-louisa-final\n",
|
||
4 years ago
|
"line 55 Camilo\n",
|
||
4 years ago
|
"line 55 newest patch_floor_rain\n",
|
||
|
"line 55 jacopo.otherness.def\n",
|
||
|
"line 56 2-louisa-final\n",
|
||
4 years ago
|
"line 56 Camilo\n",
|
||
4 years ago
|
"line 56 newest patch_floor_rain\n",
|
||
|
"line 56 jacopo.otherness.def\n",
|
||
|
"line 57 2-louisa-final\n",
|
||
4 years ago
|
"line 57 Camilo\n",
|
||
4 years ago
|
"line 57 newest patch_floor_rain\n",
|
||
|
"line 57 jacopo.otherness.def\n",
|
||
|
"line 58 2-louisa-final\n",
|
||
4 years ago
|
"line 58 Camilo\n",
|
||
4 years ago
|
"line 58 newest patch_floor_rain\n",
|
||
|
"line 58 jacopo.otherness.def\n",
|
||
|
"line 59 2-louisa-final\n",
|
||
4 years ago
|
"line 59 Camilo\n",
|
||
4 years ago
|
"line 59 newest patch_floor_rain\n",
|
||
|
"line 59 jacopo.otherness.def\n",
|
||
|
"line 60 2-louisa-final\n",
|
||
4 years ago
|
"line 60 Camilo\n",
|
||
4 years ago
|
"line 60 newest patch_floor_rain\n",
|
||
|
"line 60 jacopo.otherness.def\n",
|
||
|
"line 61 2-louisa-final\n",
|
||
4 years ago
|
"line 61 Camilo\n",
|
||
4 years ago
|
"line 61 newest patch_floor_rain\n",
|
||
|
"line 61 jacopo.otherness.def\n",
|
||
|
"line 62 2-louisa-final\n",
|
||
4 years ago
|
"line 62 Camilo\n",
|
||
4 years ago
|
"line 62 newest patch_floor_rain\n",
|
||
|
"line 62 jacopo.otherness.def\n",
|
||
|
"line 63 2-louisa-final\n",
|
||
4 years ago
|
"line 63 Camilo\n",
|
||
4 years ago
|
"line 63 newest patch_floor_rain\n",
|
||
|
"line 63 jacopo.otherness.def\n",
|
||
|
"line 64 2-louisa-final\n",
|
||
4 years ago
|
"line 64 Camilo\n",
|
||
4 years ago
|
"line 64 newest patch_floor_rain\n",
|
||
|
"line 64 jacopo.otherness.def\n",
|
||
|
"line 65 2-louisa-final\n",
|
||
4 years ago
|
"line 65 Camilo\n",
|
||
4 years ago
|
"line 65 newest patch_floor_rain\n",
|
||
|
"line 65 jacopo.otherness.def\n",
|
||
|
"line 66 2-louisa-final\n",
|
||
4 years ago
|
"line 66 Camilo\n",
|
||
4 years ago
|
"line 66 newest patch_floor_rain\n",
|
||
|
"line 66 jacopo.otherness.def\n",
|
||
|
"line 67 2-louisa-final\n",
|
||
4 years ago
|
"line 67 Camilo\n",
|
||
4 years ago
|
"line 67 newest patch_floor_rain\n",
|
||
|
"line 67 jacopo.otherness.def\n",
|
||
|
"line 68 2-louisa-final\n",
|
||
4 years ago
|
"line 68 Camilo\n",
|
||
4 years ago
|
"line 68 newest patch_floor_rain\n",
|
||
|
"line 68 jacopo.otherness.def\n",
|
||
|
"line 69 2-louisa-final\n",
|
||
4 years ago
|
"line 69 Camilo\n",
|
||
4 years ago
|
"line 69 newest patch_floor_rain\n",
|
||
|
"line 69 jacopo.otherness.def\n",
|
||
|
"line 70 2-louisa-final\n",
|
||
4 years ago
|
"line 70 Camilo\n",
|
||
4 years ago
|
"line 70 newest patch_floor_rain\n",
|
||
|
"line 70 jacopo.otherness.def\n",
|
||
|
"line 71 2-louisa-final\n",
|
||
4 years ago
|
"line 71 Camilo\n",
|
||
4 years ago
|
"line 71 newest patch_floor_rain\n",
|
||
|
"line 71 jacopo.otherness.def\n",
|
||
|
"line 72 2-louisa-final\n",
|
||
4 years ago
|
"line 72 Camilo\n",
|
||
4 years ago
|
"line 72 newest patch_floor_rain\n",
|
||
|
"line 72 jacopo.otherness.def\n",
|
||
|
"line 73 2-louisa-final\n",
|
||
4 years ago
|
"line 73 Camilo\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"ename": "IndexError",
|
||
|
"evalue": "list index out of range",
|
||
|
"output_type": "error",
|
||
|
"traceback": [
|
||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||
|
"\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)",
|
||
|
"\u001b[0;32m<ipython-input-6-c95e08ba452e>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mpatch\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrow\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"line {linenumber} {patch}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mline\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"patches/{patch}.txt\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreadlines\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mlinenumber\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0mline\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mline\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrstrip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"\\n\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mline\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfile\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0moutput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m''\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
||
|
"\u001b[0;31mIndexError\u001b[0m: list index out of range"
|
||
4 years ago
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"output = open(\"my-fantastic-quilt\", 'w')\n",
|
||
|
"for row in quilt:\n",
|
||
|
"\n",
|
||
|
" for linenumber in range(74):\n",
|
||
|
" for patch in row:\n",
|
||
|
" print(f\"line {linenumber} {patch}\")\n",
|
||
4 years ago
|
" line = open(f\"patches/{patch}.txt\").readlines()[linenumber]\n",
|
||
4 years ago
|
" line = line.rstrip(\"\\n\")\n",
|
||
|
" print(line, file=output, end='')\n",
|
||
|
" print(file=output)\n",
|
||
|
"# print(line)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
4 years ago
|
"execution_count": 5,
|
||
4 years ago
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"from reportlab.pdfgen.canvas import Canvas\n",
|
||
|
"from reportlab.lib.pagesizes import A4,A0\n",
|
||
|
"from reportlab.lib.units import mm\n",
|
||
4 years ago
|
"from reportlab.pdfbase.ttfonts import TTFont, pdfmetrics\n",
|
||
|
"\n",
|
||
4 years ago
|
"pagewidth, pageheight = A0\n",
|
||
|
"\n",
|
||
4 years ago
|
"c = Canvas(\"quilts/quilt_WFTF.pdf\", pagesize=(pagewidth, pageheight), bottomup=0) \n",
|
||
4 years ago
|
"\n",
|
||
|
"\n",
|
||
|
"fontpath = \"fonts/mplus-1m-regular.ttf\"\n",
|
||
|
"font = TTFont('1mregular', fontpath)\n",
|
||
|
"pdfmetrics.registerFont(font)\n",
|
||
|
"\n",
|
||
|
"# To set a font in the PDF\n",
|
||
|
"c.setFont('1mregular', 14.4)\n",
|
||
|
"\n",
|
||
4 years ago
|
"start_y = 5*mm\n",
|
||
|
"y = start_y\n",
|
||
|
"lineheight = 4*mm\n",
|
||
4 years ago
|
"\n",
|
||
4 years ago
|
"lines = open(\"my-fantastic-quilt\").readlines()\n",
|
||
4 years ago
|
"\n",
|
||
4 years ago
|
"for line in lines:\n",
|
||
4 years ago
|
" c.drawString(2*mm, y, line)\n",
|
||
4 years ago
|
" y += lineheight\n",
|
||
|
"\n",
|
||
|
"c.save()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.7.3"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 4
|
||
|
}
|