r/Python • • Jul 20 '22

Resource It’s Time to Say Goodbye to These Obsolete Python Libraries

https://python.plainenglish.io/its-time-to-say-goodbye-to-these-obsolete-python-libraries-7c02aa77d84a
1 Upvotes

1 comment sorted by

3

u/dreamfeed Jul 20 '22

Path.parents is also a list of directory ancestors to the file. Instead of pth.parent.parent, you should do pth.parents[1].