make_file_pathname
- pyrcs.utils.make_file_pathname(cls, data_name, ext='.pickle', data_dir=None)
Make a pathname for saving data as a file of a certain format.
- Parameters
cls (object) – (an instance of) a class for a certain data cluster
data_name (str) – key to the dict-type data of a certain code cluster
ext (str) – file extension, defaults to
".pickle"
data_dir (str or None) – name of a folder where the data is saved, defaults to
None
- Returns
a pathname for saving the data
- Return type
str
Example:
>>> from pyrcs.utils import make_file_pathname >>> from pyrcs.line_data import Bridges >>> import os >>> bridges = Bridges() >>> example_pathname = make_file_pathname(bridges, data_name="example-data", ext=".pickle") >>> os.path.relpath(example_pathname) 'pyrcs\data\line-data\bridges\example-data.pickle'