{ "cells": [ { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "output_type": "stream", "name": "stdout", "text": "\nMappe1.xlsx\n.xlsx\nMappe1\n" } ], "source": [ "from pathlib import PurePath\n", "\n", "filename = PurePath(\"Excel\\\\Mappe1.xlsx\")\n", "\n", "print(filename.absolute)\n", "print(filename.name)\n", "# prints \"raw_data.txt\"\n", "\n", "print(filename.suffix)\n", "# prints \"txt\"\n", "\n", "print(filename.stem)\n", "# prints \"raw_data\"\n", "\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "output_type": "error", "ename": "TypeError", "evalue": "This COM object can not automate the makepy process - please run makepy manually for this object", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mcom_error\u001b[0m Traceback (most recent call last)", "\u001b[1;32mC:\\dev\\Python\\Python38-32\\lib\\site-packages\\win32com\\client\\gencache.py\u001b[0m in \u001b[0;36mEnsureDispatch\u001b[1;34m(prog_id, bForDemand)\u001b[0m\n\u001b[0;32m 529\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 530\u001b[1;33m \u001b[0mti\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdisp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_oleobj_\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mGetTypeInfo\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 531\u001b[0m \u001b[0mdisp_clsid\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mti\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mGetTypeAttr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mcom_error\u001b[0m: (-2147467263, 'Nicht implementiert', None, None)", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mwin32com\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mtr\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mwin32com\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mgencache\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mEnsureDispatch\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"CognosTransformer.Application\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[1;32mC:\\dev\\Python\\Python38-32\\lib\\site-packages\\win32com\\client\\gencache.py\u001b[0m in \u001b[0;36mEnsureDispatch\u001b[1;34m(prog_id, bForDemand)\u001b[0m\n\u001b[0;32m 539\u001b[0m \u001b[0mdisp\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdisp_class\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdisp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_oleobj_\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 540\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mpythoncom\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcom_error\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 541\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mTypeError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"This COM object can not automate the makepy process - please run makepy manually for this object\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 542\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 543\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mTypeError\u001b[0m: This COM object can not automate the makepy process - please run makepy manually for this object" ] } ], "source": [ "import win32com.client\n", "tr = win32com.client.gencache.EnsureDispatch(\"CognosTransformer.Application\")\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "tags": [] }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": "Could not locate a type library matching 'C:\\Program Files (x86)\\Cognos\\cer5\\bin\\trnsfrmr.dll'\n" } ], "source": [ "import sys\n", "from win32com.client import makepy\n", "\n", "outputFile = \"C:\\\\Projekte\\\\Python\\\\transformer_automation.py\"\n", "comTypeLibraryOrDLL = \"C:\\\\Program Files (x86)\\\\Cognos\\\\cer5\\\\bin\\\\transdll.dll\"\n", "sys.argv = [\"makepy\", \"-o\", outputFile, comTypeLibraryOrDLL]\n", "\n", "makepy.main ()" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "'jvvr://yyy.ravjqpejcnngpig.eqo/re/fgh/ocr.jvon'" ] }, "metadata": {}, "execution_count": 18 } ], "source": [ "sentence = 'g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyrq ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.'\n", "url = 'http://www.pythonchallenge.com/pc/def/map.html'\n", "alphabet = [chr(x) for x in range(97, 123)] + ['a', 'b']\n", "''.join([alphabet[alphabet.index(x)+2] if x in alphabet else x for x in url])" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Help on built-in function maketrans:\n\nmaketrans(...)\n Return a translation table usable for str.translate().\n \n If there is only one argument, it must be a dictionary mapping Unicode\n ordinals (integers) or characters to Unicode ordinals, strings or None.\n Character keys will be then converted to ordinals.\n If there are two arguments, they must be strings of equal length, and\n in the resulting dictionary, each character in x will be mapped to the\n character at the same position in y. If there is a third argument, it\n must be a string, whose characters will be mapped to None in the result.\n\n" ] } ], "source": [ "help(str.maketrans)" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "'htmlheadtitleocrtitlelinkrelstylesheettypetextcsshrefstylecssheadbodycenterimgsrcocrjpgbrfontcolorcrecognizethecharactersmaybetheyareinthebookbrbuttheyareinthepagesourcecenterbrbrbrfontsizecolorgoldeneraltipslisethehintsheyarehelpfulmostofthetimeslilinvestigatethedatagiventoyoulilivoidlookingforspoilerslibrorumsahrefhttpwwwpythonchallengecomforumsythonhallengeorumsareadbeforeyoupostbrircfreenodenetpythonchallengebrbroseethesolutionstothepreviouslevelreplacepcwithpcciegotohttpwwwpythonchallengecompccdefocrhtmlbodyhtmlfindrarecharactersinthemessbelowequality'" ] }, "metadata": {}, "execution_count": 31 } ], "source": [ "import requests\n", "import re\n", "\n", "res = requests.get('http://www.pythonchallenge.com/pc/def/ocr.html')\n", "''.join([x if x in alphabet else '' for x in res.content.decode('utf-8')])\n", "# p.match(res.content.decode())" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "['qIQNlQSLi', 'eOEKiVEYj', 'aZADnMCZq', 'bZUTkLYNg', 'uCNDeHSBj', 'kOIXdKBFh', 'dXJVlGZVm', 'gZAGiLQZx', 'vCJAsACFl', 'qKWGtIDCj']\n" ] } ], "source": [ "import requests\n", "import re\n", "\n", "res = requests.get('http://www.pythonchallenge.com/pc/def/equality.html')\n", "p = re.compile(r'[^A-Z][A-Z]{3}[a-z][A-Z]{3}[^A-Z]')\n", "m = p.findall(res.content.decode('utf-8'))\n", "print(m)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ " Konto_Nr Konto_Bezeichnung Konto_Art \\\n", "0 0001 Aufwendungen für die Ingangsetzung und Erweite... 1 \n", "1 0010 Entgeltlich erworbene Konzessionen, gewerblich... 1 \n", "2 0015 Konzessionen 1 \n", "3 0020 Gewerbliche Schutzrechte 1 \n", "4 0025 Ähnliche Rechte und Werte 1 \n", "... ... ... ... \n", "5504 MAR_0600 Volkswagen PKW MAR \n", "5505 MAR_9101 Volvo MAR \n", "5506 MAR_0100 Daimler MAR \n", "5507 MAR_0110 Mercedes Benz MAR \n", "5508 MAR_0121 smart Pkw MAR \n", "\n", " Konto_KST Konto_STK Konto_1 Konto_2 Konto_3 Konto_4 Konto_5 ... \\\n", "0 ... \n", "1 ... \n", "2 ... \n", "3 ... \n", "4 ... \n", "... ... ... ... ... ... ... ... ... \n", "5504 ... \n", "5505 ... \n", "5506 ... \n", "5507 ... \n", "5508 ... \n", "\n", " LetzteEbene4_Nr LetzteEbene4_Bez Teile LetzteEbene5 \\\n", "0 XX;;;;;;;;; XX \n", "1 XX;;;;;;;;; XX \n", "2 XX;;;;;;;;; XX \n", "3 XX;;;;;;;;; XX \n", "4 XX;;;;;;;;; XX \n", "... ... ... ... ... \n", "5504 ;;;;;;;;; \n", "5505 ;;;;;;;;; \n", "5506 ;;;;;;;;; \n", "5507 ;;;;;;;;; \n", "5508 ;;;;;;;;; \n", "\n", " LetzteEbene5_Nr LetzteEbene5_Bez Weitere LetzteEbene6 \\\n", "0 XX;;;;;;;;; XX \n", "1 XX;;;;;;;;; XX \n", "2 XX;;;;;;;;; XX \n", "3 XX;;;;;;;;; XX \n", "4 XX;;;;;;;;; XX \n", "... ... ... ... ... \n", "5504 ;;;;;;;;; \n", "5505 ;;;;;;;;; \n", "5506 ;;;;;;;;; \n", "5507 ;;;;;;;;; \n", "5508 ;;;;;;;;; \n", "\n", " LetzteEbene6_Nr LetzteEbene6_Bez \n", "0 \n", "1 \n", "2 \n", "3 \n", "4 \n", "... ... ... \n", "5504 \n", "5505 \n", "5506 \n", "5507 \n", "5508 \n", "\n", "[5509 rows x 94 columns]" ], "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Konto_NrKonto_BezeichnungKonto_ArtKonto_KSTKonto_STKKonto_1Konto_2Konto_3Konto_4Konto_5...LetzteEbene4_NrLetzteEbene4_BezTeileLetzteEbene5LetzteEbene5_NrLetzteEbene5_BezWeitereLetzteEbene6LetzteEbene6_NrLetzteEbene6_Bez
00001Aufwendungen für die Ingangsetzung und Erweite...1...XX;;;;;;;;;XXXX;;;;;;;;;XX
10010Entgeltlich erworbene Konzessionen, gewerblich...1...XX;;;;;;;;;XXXX;;;;;;;;;XX
20015Konzessionen1...XX;;;;;;;;;XXXX;;;;;;;;;XX
30020Gewerbliche Schutzrechte1...XX;;;;;;;;;XXXX;;;;;;;;;XX
40025Ähnliche Rechte und Werte1...XX;;;;;;;;;XXXX;;;;;;;;;XX
..................................................................
5504MAR_0600Volkswagen PKWMAR...;;;;;;;;;;;;;;;;;;
5505MAR_9101VolvoMAR...;;;;;;;;;;;;;;;;;;
5506MAR_0100DaimlerMAR...;;;;;;;;;;;;;;;;;;
5507MAR_0110Mercedes BenzMAR...;;;;;;;;;;;;;;;;;;
5508MAR_0121smart PkwMAR...;;;;;;;;;;;;;;;;;;
\n

5509 rows × 94 columns

\n
" }, "metadata": {}, "execution_count": 4 } ], "source": [ "import gcstruct\n", "gcstruct.struct_config('P:\\\\SKR51_GCStruct\\\\GCStruct_Portal')\n", "df = gcstruct.accounts_from_csv(gcstruct.config['struct'])\n", "df\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "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.8.2-final" }, "orig_nbformat": 2, "kernelspec": { "name": "python38232bitbfe000d0e0804f0ba6fab56a16b38371", "display_name": "Python 3.8.2 32-bit", "language": "python" } }, "nbformat": 4, "nbformat_minor": 2 }