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


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

Re: Making safe file names

Started byFábio Santos <fabiosantosart@gmail.com>
First post2013-05-07 23:18 +0100
Last post2013-05-07 23:18 +0100
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 Fábio Santos <fabiosantosart@gmail.com> - 2013-05-07 23:18 +0100

#44909 — Re: Making safe file names

FromFábio Santos <fabiosantosart@gmail.com>
Date2013-05-07 23:18 +0100
SubjectRe: Making safe file names
Message-ID<mailman.1422.1367965130.3114.python-list@python.org>
I suggest Base64. b64encode
(http://docs.python.org/2/library/base64.html#base64.b64encode) and
b64decode take an argument which allows you to eliminate the pesky "/"
character. It's reversible and simple.

More suggestions: how about a hash? Or just use IDs from the database?

On Tue, May 7, 2013 at 8:58 PM, Andrew Berg <bahamutzero8825@gmail.com> 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.
> --
> CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1
> --
> http://mail.python.org/mailman/listinfo/python-list



--
Fábio Santos

[toc] | [standalone]


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


csiph-web