[Tutor] Simple Regex

dn PyTutor at DancesWithMice.info
Thu Apr 8 16:32:55 EDT 2021


On 09/04/2021 08.25, dn via Tutor wrote:
> On 09/04/2021 05.43, Joao Carlos Silva de Oliveira Matos via Tutor wrote:
>> Hello everyone,
>>
>> I have to parse a regex for the first time. I have this path:
>> *C:\Users\user\Downloads\4324234534254325\4324234534254325_213.csv.*
>>
>> I want to retrieve the name of the folder between "Downloads\" and
>> "\filename".
>>
>> How do I do this?
> 
> 
> Does pathlib, from the Python Standard Library help?
> https://docs.python.org/3/library/pathlib.html?highlight=pathlib#module-pathlib

In the ?good, old days, we used combinations of the os and sys
libraries. So, if you are reading code, you may see constructs of such.
- these days the preference is for the above.

https://docs.python.org/3/library/os.html
https://docs.python.org/3/library/os.path.html
-- 
Regards,
=dn


More information about the Tutor mailing list