Dateien nach "ipynb" hochladen
This commit is contained in:
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"id": "b50d1c76-5cbf-48f4-b97f-0dc1905b32ed",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Die Zip-Datei \"sentipy.zip\" wurde erfolgreich entpackt.\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import shutil\n",
|
||||||
|
"import os\n",
|
||||||
|
"import zipfile\n",
|
||||||
|
"\n",
|
||||||
|
"def unpack(zipfilename):\n",
|
||||||
|
" # Überprüfen, ob die Zip-Datei existiert\n",
|
||||||
|
" if os.path.isfile(zipfilename):\n",
|
||||||
|
" # Zip-Datei entpacken\n",
|
||||||
|
" with zipfile.ZipFile(zipfilename, 'r') as zip_ref:\n",
|
||||||
|
" zip_ref.extractall(zipfilename[0:-4])\n",
|
||||||
|
" print(f'Die Zip-Datei \"{zipfilename}\" wurde erfolgreich entpackt.')\n",
|
||||||
|
" else:\n",
|
||||||
|
" print(f'Die Zip-Datei \"{zipfilename}\" existiert nicht.')\n",
|
||||||
|
"unpack(\"sentipy.zip\")"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "88e68b09-0d52-4da6-9ee6-eed39a725587",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3 (ipykernel)",
|
||||||
|
"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.11.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user