So, i have a variable, for example dir = "Crypter.aes"
. I need to variable like dir
, but without .aes
. What gotta I do for that? I use directory parser, that make many dir
with file name in that directory, and for each file I need to remove a certain part at the end - .aes
Asked
Active
Viewed 35 times
-2

ツHayKor
- 1
-
`dir = dir.split('.')[0]`? – Green Cloak Guy Jul 22 '20 at 16:20
-
Beside the point, but don't use `dir` as a variable name since it shadows the [builtin `dir`](https://docs.python.org/3/library/functions.html#dir). – wjandrea Jul 22 '20 at 16:26
-
Does this answer your question? [How to get the filename without the extension from a path in Python?](https://stackoverflow.com/questions/678236/how-to-get-the-filename-without-the-extension-from-a-path-in-python) – wjandrea Jul 22 '20 at 16:29
-
It doesn't work with my script. I make script with pyAesCrypt, that has syntax like ```pyAesCrypt.decryptFile(inputFile, outputFile, password, buffersize)```. Input file is file with ```.aes``` in the end, output file gotta be with out ```.aes```, but when I use this method, I get error " File "..." was not found" – ツHayKor Jul 22 '20 at 16:36
-
wjandrea, yes, it is, THX soo – ツHayKor Jul 22 '20 at 16:38