A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-March/071996.html below:

[Python-Dev] Proposal to revert r54204 (splitext change)

[Python-Dev] Proposal to revert r54204 (splitext change)Mike Krell mbk.lists at gmail.com
Thu Mar 15 21:47:48 CET 2007
On 3/15/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> Can you show us the relevant fragment of your code?

Sure:

    for f in files:
        try:
            (root, ext) = os.path.splitext(f)
            os.rename(f, '%s.%s%s' % (root, index, ext))
        except OSError:
            die('renaming %s failed' % f)

Background:

This is a little utility that runs on windows that archives arbitrary
files.  index is an integer.
For index == 1, I want "a.txt" to be renamed to "a.1.txt", and I want
".emacs" to be renamed to ".1.emacs", thus preserving the extensions.
Under the new patch, the second file would be renamed to ".emacs.1",
gratuitously breaking the extension preservation.

   Mike
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4