from pathlib import PurePath
filename = PurePath("Excel\\Mappe1.xlsx")
print(filename.absolute)
print(filename.name)
# prints "raw_data.txt"
print(filename.suffix)
# prints "txt"
print(filename.stem)
# prints "raw_data"
<bound method Path.absolute of WindowsPath('Excel/Mappe1.xlsx')> Mappe1.xlsx .xlsx Mappe1
import win32com.client
tr = win32com.client.gencache.EnsureDispatch("CognosTransformer.Application")
[1;31m---------------------------------------------------------------------------[0m [1;31mcom_error[0m Traceback (most recent call last) [1;32mC:\dev\Python\Python38-32\lib\site-packages\win32com\client\gencache.py[0m in [0;36mEnsureDispatch[1;34m(prog_id, bForDemand)[0m [0;32m 529[0m [1;32mtry[0m[1;33m:[0m[1;33m[0m[1;33m[0m[0m [1;32m--> 530[1;33m [0mti[0m [1;33m=[0m [0mdisp[0m[1;33m.[0m[0m_oleobj_[0m[1;33m.[0m[0mGetTypeInfo[0m[1;33m([0m[1;33m)[0m[1;33m[0m[1;33m[0m[0m [0m[0;32m 531[0m [0mdisp_clsid[0m [1;33m=[0m [0mti[0m[1;33m.[0m[0mGetTypeAttr[0m[1;33m([0m[1;33m)[0m[1;33m[[0m[1;36m0[0m[1;33m][0m[1;33m[0m[1;33m[0m[0m [1;31mcom_error[0m: (-2147467263, 'Nicht implementiert', None, None) During handling of the above exception, another exception occurred: [1;31mTypeError[0m Traceback (most recent call last) [1;32m<ipython-input-4-45d6d54b965f>[0m in [0;36m<module>[1;34m[0m [0;32m 1[0m [1;32mimport[0m [0mwin32com[0m[1;33m.[0m[0mclient[0m[1;33m[0m[1;33m[0m[0m [1;32m----> 2[1;33m [0mtr[0m [1;33m=[0m [0mwin32com[0m[1;33m.[0m[0mclient[0m[1;33m.[0m[0mgencache[0m[1;33m.[0m[0mEnsureDispatch[0m[1;33m([0m[1;34m"CognosTransformer.Application"[0m[1;33m)[0m[1;33m[0m[1;33m[0m[0m [0m [1;32mC:\dev\Python\Python38-32\lib\site-packages\win32com\client\gencache.py[0m in [0;36mEnsureDispatch[1;34m(prog_id, bForDemand)[0m [0;32m 539[0m [0mdisp[0m [1;33m=[0m [0mdisp_class[0m[1;33m([0m[0mdisp[0m[1;33m.[0m[0m_oleobj_[0m[1;33m)[0m[1;33m[0m[1;33m[0m[0m [0;32m 540[0m [1;32mexcept[0m [0mpythoncom[0m[1;33m.[0m[0mcom_error[0m[1;33m:[0m[1;33m[0m[1;33m[0m[0m [1;32m--> 541[1;33m [1;32mraise[0m [0mTypeError[0m[1;33m([0m[1;34m"This COM object can not automate the makepy process - please run makepy manually for this object"[0m[1;33m)[0m[1;33m[0m[1;33m[0m[0m [0m[0;32m 542[0m [1;32mreturn[0m [0mdisp[0m[1;33m[0m[1;33m[0m[0m [0;32m 543[0m [1;33m[0m[0m [1;31mTypeError[0m: This COM object can not automate the makepy process - please run makepy manually for this object
import sys
from win32com.client import makepy
outputFile = "C:\\Projekte\\Python\\transformer_automation.py"
comTypeLibraryOrDLL = "C:\\Program Files (x86)\\Cognos\\cer5\\bin\\transdll.dll"
sys.argv = ["makepy", "-o", outputFile, comTypeLibraryOrDLL]
makepy.main ()
Could not locate a type library matching 'C:\Program Files (x86)\Cognos\cer5\bin\trnsfrmr.dll'
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.'
url = 'http://www.pythonchallenge.com/pc/def/map.html'
alphabet = [chr(x) for x in range(97, 123)] + ['a', 'b']
''.join([alphabet[alphabet.index(x)+2] if x in alphabet else x for x in url])
'jvvr://yyy.ravjqpejcnngpig.eqo/re/fgh/ocr.jvon'
help(str.maketrans)
Help on built-in function maketrans: maketrans(...) Return a translation table usable for str.translate(). If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
import requests
import re
res = requests.get('http://www.pythonchallenge.com/pc/def/ocr.html')
''.join([x if x in alphabet else '' for x in res.content.decode('utf-8')])
# p.match(res.content.decode())
'htmlheadtitleocrtitlelinkrelstylesheettypetextcsshrefstylecssheadbodycenterimgsrcocrjpgbrfontcolorcrecognizethecharactersmaybetheyareinthebookbrbuttheyareinthepagesourcecenterbrbrbrfontsizecolorgoldeneraltipslisethehintsheyarehelpfulmostofthetimeslilinvestigatethedatagiventoyoulilivoidlookingforspoilerslibrorumsahrefhttpwwwpythonchallengecomforumsythonhallengeorumsareadbeforeyoupostbrircfreenodenetpythonchallengebrbroseethesolutionstothepreviouslevelreplacepcwithpcciegotohttpwwwpythonchallengecompccdefocrhtmlbodyhtmlfindrarecharactersinthemessbelowequality'
import requests
import re
res = requests.get('http://www.pythonchallenge.com/pc/def/equality.html')
p = re.compile(r'[^A-Z][A-Z]{3}[a-z][A-Z]{3}[^A-Z]')
m = p.findall(res.content.decode('utf-8'))
print(m)
['qIQNlQSLi', 'eOEKiVEYj', 'aZADnMCZq', 'bZUTkLYNg', 'uCNDeHSBj', 'kOIXdKBFh', 'dXJVlGZVm', 'gZAGiLQZx', 'vCJAsACFl', 'qKWGtIDCj']
import gcstruct
gcstruct.struct_config('P:\\SKR51_GCStruct\\GCStruct_Portal')
df = gcstruct.accounts_from_csv(gcstruct.config['struct'])
df
Konto_Nr | Konto_Bezeichnung | Konto_Art | Konto_KST | Konto_STK | Konto_1 | Konto_2 | Konto_3 | Konto_4 | Konto_5 | ... | LetzteEbene4_Nr | LetzteEbene4_Bez | Teile | LetzteEbene5 | LetzteEbene5_Nr | LetzteEbene5_Bez | Weitere | LetzteEbene6 | LetzteEbene6_Nr | LetzteEbene6_Bez | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0001 | Aufwendungen für die Ingangsetzung und Erweite... | 1 | ... | XX;;;;;;;;; | XX | XX;;;;;;;;; | XX | |||||||||||||
1 | 0010 | Entgeltlich erworbene Konzessionen, gewerblich... | 1 | ... | XX;;;;;;;;; | XX | XX;;;;;;;;; | XX | |||||||||||||
2 | 0015 | Konzessionen | 1 | ... | XX;;;;;;;;; | XX | XX;;;;;;;;; | XX | |||||||||||||
3 | 0020 | Gewerbliche Schutzrechte | 1 | ... | XX;;;;;;;;; | XX | XX;;;;;;;;; | XX | |||||||||||||
4 | 0025 | Ähnliche Rechte und Werte | 1 | ... | XX;;;;;;;;; | XX | XX;;;;;;;;; | XX | |||||||||||||
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
5504 | MAR_0600 | Volkswagen PKW | MAR | ... | ;;;;;;;;; | ;;;;;;;;; | |||||||||||||||
5505 | MAR_9101 | Volvo | MAR | ... | ;;;;;;;;; | ;;;;;;;;; | |||||||||||||||
5506 | MAR_0100 | Daimler | MAR | ... | ;;;;;;;;; | ;;;;;;;;; | |||||||||||||||
5507 | MAR_0110 | Mercedes Benz | MAR | ... | ;;;;;;;;; | ;;;;;;;;; | |||||||||||||||
5508 | MAR_0121 | smart Pkw | MAR | ... | ;;;;;;;;; | ;;;;;;;;; |
5509 rows × 94 columns