{ "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.6.8" } }, "nbformat": 4, "nbformat_minor": 2, "cells": [ { "source": [ "# Parameters\n", "INPUT_DATA_PATH = INPUT_DATA_PATH or \"\"\n", "OUTPUT_DATA_PATH = OUTPUT_DATA_PATH or \"\"" ], "cell_type": "code", "metadata": {}, "execution_count": null, "outputs": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [] }, "outputs": [], "source": [ "# Show the parameter values\n", "print('INPUT_DATA_PATH = ' + INPUT_DATA_PATH)\n", "print('OUTPUT_DATA_PATH = ' + OUTPUT_DATA_PATH)\n", "print('locals() = ' + str(locals()))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Checking the input data\n", "import os\n", "\n", "if INPUT_DATA_PATH:\n", " if os.path.isdir(INPUT_DATA_PATH):\n", " print('os.listdir(INPUT_DATA_PATH):')\n", " print(os.listdir(INPUT_DATA_PATH))\n", " if os.path.isfile(INPUT_DATA_PATH):\n", " print('os.stat(INPUT_DATA_PATH):')\n", " print(os.stat(INPUT_DATA_PATH))\n", "else:\n", " print('INPUT_DATA_PATH is empty')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Writing some output data\n", "from pathlib import Path\n", "\n", "(Path(OUTPUT_DATA_PATH) / 'output.txt').write_text(\"Hello world!\")" ] } ] }