file_name_sequence, a Python code which demonstrates ways of generating a sequence of file names with an embedded index that increases.

There are situations such as animations or parallel processing in which it is necessary to generate a sequence of file names which include an embedded index that increases. A simple example might be

        'fred0.txt', 'fred1.txt', 'fred2.txt'
A side issue arises when the number of files is large enough that the number of digits in the index will vary. Thus, if we are going to have 15 files, do we want to number them as
        'fred00.txt' through 'fred14.txt'
which means, for one thing, that they will alphabetize properly, or will we be satisfied with
        'fred0.txt' through 'fred14.txt' ?


The computer code and data files described and made available on this web page are distributed under the MIT license


file_name_sequence is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.

Related Data and codes:

chrpak, a Python code which works with characters and strings.

filum, a Python code which can work with information in text files.

Source Code:

Last revised on 17 March 2010.