why am I getting a segmentation fault?

Jeff Shannon jeff at ccvcorp.com
Fri Jan 21 17:52:54 EST 2005


Paul McGuire wrote:

> 4. filename=r[7].split('/')[-1] is not terribly portable.  See if there is a
> standard module for parsing filespecs (I'll bet there is).

Indeed there is -- os.path.  In particular, os.path.basename() seems 
to do exactly that snippet is intending, in a much more robust (and 
readable) fashion.

Jeff Shannon
Technician/Programmer
Credit International




More information about the Python-list mailing list