Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44907 > unrolled thread

Re: Making safe file names

Started byTerry Jan Reedy <tjreedy@udel.edu>
First post2013-05-07 18:01 -0400
Last post2013-05-07 18:01 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Making safe file names Terry Jan Reedy <tjreedy@udel.edu> - 2013-05-07 18:01 -0400

#44907 — Re: Making safe file names

FromTerry Jan Reedy <tjreedy@udel.edu>
Date2013-05-07 18:01 -0400
SubjectRe: Making safe file names
Message-ID<mailman.1420.1367964109.3114.python-list@python.org>
On 5/7/2013 3:58 PM, Andrew Berg wrote:
> Currently, I keep Last.fm artist data caches to avoid unnecessary API calls and have been naming the files using the artist name. However,
> artist names can have characters that are not allowed in file names for most file systems (e.g., C/A/T has forward slashes). Are there any
> recommended strategies for naming such files while avoiding conflicts (I wouldn't want to run into problems for an artist named C-A-T or
> CAT, for example)? I'd like to make the files easily identifiable, and there really are no limits on what characters can be in an artist name.

Sounds like you want something like the html escape or urlencode 
functions, which serve the same purpose of encoding special chars. 
Rather than invent a new tranformation, you could use the same scheme 
used for html entities. (Sorry, I forget the details.) It is possible 
that one of the functions would work for you as is, or with little 
modification.

Terry


[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web