[Python-ideas] PEP 428 - object-oriented filesystem paths

Antoine Pitrou solipsis at pitrou.net
Sat Oct 6 01:48:23 CEST 2012


On Fri, 05 Oct 2012 14:38:57 -0700
Ethan Furman <ethan at stoneleaf.us> wrote:
> 
> Say I have a .dbf table as PureNTPath('c:\orders\12345\abc67890.dbf'), 
> and I export it to .csv in the same folder; how would I transform the 
> above PureNTPath's ext from 'dbf' to 'csv'?

Something like:

>>> p = PureNTPath('c:/orders/12345/abc67890.dbf')
>>> p.parent()[p.name.split('.')[0] + '.csv']
PureNTPath('c:\\orders\\12345\\abc67890.csv')

Any suggestion to ease this use case a bit?

Regards

Antoine.


-- 
Software development and contracting: http://pro.pitrou.net





More information about the Python-ideas mailing list