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


Groups > comp.lang.python > #102751

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

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Kaynor <ckaynor@zindagigames.com>
Newsgroups comp.lang.python
Subject Re: [SOLVED] There has to be a better way to split this string!
Date Tue, 9 Feb 2016 18:02:27 -0800
Lines 27
Message-ID <mailman.15.1455069770.7749.python-list@python.org> (permalink)
References <56BA91B5.5090400@cajuntechie.org> <56BA9505.40900@cajuntechie.org> <85mvr972vv.fsf@benfinney.id.au> <56BA9942.9060904@cajuntechie.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de sHsqVhhT+TtRMOkwnyDZ5AhTJ5oS1Sqf4ZGmHoDWYJ1g==
Return-Path <ckaynor@zindagigames.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.03; 'think,': 0.05; 'filename': 0.07; 'filename,': 0.09; 'filename.': 0.09; 'subject:string': 0.09; '&gt;&gt;&gt;': 0.15; '2016': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:There': 0.16; 'wrote:': 0.16; 'looked': 0.16; '&gt;': 0.18; 'subject:] ': 0.19; '>>>': 0.20; 'to:name:python-list@python.org': 0.20; 'feb': 0.23; 'header:In-Reply-To:1': 0.24; 'feature': 0.24; 'module': 0.25; "i've": 0.25; "doesn't": 0.26; 'chris': 0.26; 'skip:t 40': 0.27; 'message-id:@mail.gmail.com': 0.27; "skip:' 10": 0.28; 'purposes.': 0.29; "i'm": 0.30; 'that.': 0.30; 'task': 0.30; 'source': 0.33; 'tue,': 0.34; 'received:google.com': 0.35; 'library.': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'received:209.85.213': 0.37; 'version': 0.38; 'received:209': 0.38; 'enough': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'easy': 0.60; 'skip:u 10': 0.61; 'making': 0.62; 'skip:\xe2 10': 0.70; '8bit%:43': 0.72; 'actually,': 0.84; 'doe': 0.84; 'original.': 0.84; 'subject:this': 0.85
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=zindagigames-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=in4KYgL6+Q8oZixfWAPMe61Wb1dAIcvHPjPlzz+sGnE=; b=QNDZHbpECEARcYPzJsAW++u8no2A9wJGtG0mWM2MtWnRWwyVy7nt3mSDagdL5ruPvk puXl3ptXUQS/WIRnccTWkBbkIpm5LXz7g+HYgxGTJFH5MRCrcMQRhNdzjJgXpjcpOLUL ZvJlq7RcMWKTanBnNF82TevLL8ye5U7TeixYJAcnMw3/5moidJLoiR8Fd9KPRBJO7pb2 LYPPicsBIk8lEbfDAZLDNuHtAQVkhb3hYeKn5XFRuwVgZj2CM179r11iXKkKXrkHFZtO PpWpnd4ckxJs9De6XZHf0YqyeUoiH6Z6pS670PhrrqJrirP+Nqd4NfRoMRmJSLCBwwgR +VEw==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=in4KYgL6+Q8oZixfWAPMe61Wb1dAIcvHPjPlzz+sGnE=; b=IUfOJexpgvVxL3WkWJZnBloLWM7h1htTzhFL+A36Agw06iq5J+KecfcSP6UWywoCWD UMUPITVGA1z0l6DJImm0pJdWSyHuttvuU03O7QhzjwLQWN6wP0+RvZpe2JOOMCsBwsf7 C6NbiGM08y/XqH+/mMcWSPSXeYV23EIST0O4hPvlzxCXGOtZ9PBfWQH6A2XZHYfvmPWG G8HpzTPCJDJcAiCYFiQtPAFXzMpnuCrkZWU2cOGXlI8i1kT17H+Lw+8ZEbAsIQ4nwy4s z5VYC6jZ0lWvXrYEBdRIgPdHcqjufDx2uJkjYAYeBF3y4eaaYAErfQTuckAdyzzumWLa VasA==
X-Gm-Message-State AG10YORQ2w5pxydDlbDTmh/nIJM8c9egOJILg3rez11Px1L0nApeJRWT2XWO6C6Su7JOj/QWwQi1wajxzs9Reg==
X-Received by 10.31.5.71 with SMTP id 68mr27334013vkf.157.1455069766991; Tue, 09 Feb 2016 18:02:46 -0800 (PST)
In-Reply-To <56BA9942.9060904@cajuntechie.org>
X-Content-Filtered-By Mailman/MimeDel 2.1.21rc2
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:102751

Show key headers only | View raw


On Tue, Feb 9, 2016 at 5:58 PM, Anthony Papillion <anthony@cajuntechie.org>
wrote:
>
> On 02/09/2016 07:47 PM, Ben Finney wrote:
> > Anthony Papillion <anthony@cajuntechie.org> writes:
> >
> >> On 02/09/2016 07:26 PM, Anthony Papillion wrote:
> >>> I am using datetime.now() to create a unique version of a filename.
> >>> […]
> >>
> >> Found the solution in strftime(). Exactly what I was looking for.
> >
> > For the task of making a unique filename, you should also consider the
> > ‘tempfile’ module in the standard library.
>
> I looked at tempfile. Unfortunately, the filename has to be both
> 'unique' and 'identifiable' to the original. So if I am using mydog.jpg
> as the source and I am adding something unique to it, it has to still
> have mydog.jpg in the filename. Tempfile, I think, doesn't allow an easy
> way to do that. So I'm just adding the exact date and time which is
> unique enough for my purposes.

Actually, it doe (untested, but I've used the feature in projects):

tempfile.TemporaryFile(prefix="mydog", suffix=".jpg")

Chris

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: [SOLVED] There has to be a better way to split this string! Chris Kaynor <ckaynor@zindagigames.com> - 2016-02-09 18:02 -0800

csiph-web