Note
Go to the end to download the full example code.
biogeme.filenames¶
Examples of use of several functions.
This is designed for programmers who need examples of use of the functions of the module. The examples are designed to illustrate the syntax. They do not correspond to any meaningful model.
Michel Bierlaire Sun Jun 29 2025, 10:59:35
from IPython.core.display_functions import display
from biogeme.filenames import get_new_file_name
from biogeme.version import get_text
Version of Biogeme.
print(get_text())
biogeme 3.3.1 [2025-09-03]
Home page: http://biogeme.epfl.ch
Submit questions to https://groups.google.com/d/forum/biogeme
Michel Bierlaire, Transport and Mobility Laboratory, Ecole Polytechnique Fédérale de Lausanne (EPFL)
The role of this function is to obtain the name of a file that does not exist.
the_name = get_new_file_name('test', 'dat')
display(the_name)
test~01.dat
Now, let’s create that file, and call the function again. A suffix with a number is appended to the name of the file, before its extension.
open(the_name, 'a').close()
the_name = get_new_file_name('test', 'dat')
display(the_name)
test~02.dat
If we do it again, the number is incremented.
open(the_name, 'a').close()
the_name = get_new_file_name('test', 'dat')
display(the_name)
test~03.dat
Total running time of the script: (0 minutes 0.001 seconds)