.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/programmers/plot_filenames.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_programmers_plot_filenames.py: 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 .. GENERATED FROM PYTHON SOURCE LINES 15-21 .. code-block:: Python from IPython.core.display_functions import display from biogeme.filenames import get_new_file_name from biogeme.version import get_text .. GENERATED FROM PYTHON SOURCE LINES 22-23 Version of Biogeme. .. GENERATED FROM PYTHON SOURCE LINES 23-25 .. code-block:: Python print(get_text()) .. rst-class:: sphx-glr-script-out .. code-block:: none biogeme 3.3.3a0 [2025-12-25] 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) .. GENERATED FROM PYTHON SOURCE LINES 26-27 The role of this function is to obtain the name of a file that does not exist. .. GENERATED FROM PYTHON SOURCE LINES 27-30 .. code-block:: Python the_name = get_new_file_name('test', 'dat') display(the_name) .. rst-class:: sphx-glr-script-out .. code-block:: none test~00.dat .. GENERATED FROM PYTHON SOURCE LINES 31-34 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. .. GENERATED FROM PYTHON SOURCE LINES 34-36 .. code-block:: Python open(the_name, 'a').close() .. GENERATED FROM PYTHON SOURCE LINES 37-40 .. code-block:: Python the_name = get_new_file_name('test', 'dat') display(the_name) .. rst-class:: sphx-glr-script-out .. code-block:: none test~01.dat .. GENERATED FROM PYTHON SOURCE LINES 41-42 If we do it again, the number is incremented. .. GENERATED FROM PYTHON SOURCE LINES 42-44 .. code-block:: Python open(the_name, 'a').close() .. GENERATED FROM PYTHON SOURCE LINES 45-47 .. code-block:: Python the_name = get_new_file_name('test', 'dat') display(the_name) .. rst-class:: sphx-glr-script-out .. code-block:: none test~02.dat .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.001 seconds) .. _sphx_glr_download_auto_examples_programmers_plot_filenames.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_filenames.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_filenames.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_filenames.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_