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


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

Re: [SOLVED] There has to be a better way to split this string!

Started byAnthony Papillion <anthony@cajuntechie.org>
First post2016-02-09 19:40 -0600
Last post2016-02-09 19:40 -0600
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: [SOLVED] There has to be a better way to split this string! Anthony Papillion <anthony@cajuntechie.org> - 2016-02-09 19:40 -0600

#102745 — Re: [SOLVED] There has to be a better way to split this string!

FromAnthony Papillion <anthony@cajuntechie.org>
Date2016-02-09 19:40 -0600
SubjectRe: [SOLVED] There has to be a better way to split this string!
Message-ID<mailman.9.1455068428.7749.python-list@python.org>
On 02/09/2016 07:26 PM, Anthony Papillion wrote:
> Hello Everyone,
> 
> I am using datetime.now() to create a unique version of a filename.
> When the final file is named, it will look something like:
> 
> myfile-2015-02-09-19-08-45-4223
> 
> Notice I'm replacing all of the "."'s, " "'s, and ":"'s returned by
> datetime.now() with "-"'s. I'm doing that using the following code but
> it's freaking ugly and I KNOW there is a better way to do it. I just
> can't seem to think of it right now. Can anyone help? What is the
> "right", or at least, less ugly, way to do this task?

Found the solution in strftime(). Exactly what I was looking for.


[toc] | [standalone]


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


csiph-web