file_name_generator¶
-
outputting.
file_name_generator
(output_folder=None)[source]¶ Keeps track of filenames that have been used and generates the next unused one
Parameters: output_folder (string, optional) – The folder into which the new file will be placed. Default is the current working directory Returns: new_file_name – Creates a new file with the name <handle> and the extension <extension>. It takes two string parameters: ( handle
,extension
) and returns onefileName
stringReturn type: function Examples
>>> file_name_gen = file_name_generator("./") >>> file_name_gen("a", "b") './a.b' >>> file_name_gen("a", "b") './a_1.b' >>> file_name_gen("", "") './' >>> file_name_gen = file_name_generator() >>> fileName = file_name_gen("", "") >>> fileName == os.getcwd() False