emat/util/xmle/file_util.py
def unused_filename(basename, basepath=None):
	"Generate a filename based on the basename, but which does not yet exist"
	if basepath is None:
		base_full = basename
	else:
		base_full = os.path.join(basepath, basename)
	outfilename = base_full
	out_n = 1
	while os.path.exists(outfilename):
		head, tail = os.path.splitext(base_full)
		outfilename = '{}_{}{}'.format(head, out_n, tail)
		out_n += 1
	return outfilename
Generate a filename based on the basename, but which does not yet exist
Generate a filename based on the basename, but which does not yet exist
Generate a filename based on the basename but which does not yet exist
def unused_filename(basename, basepath=None):
	if basepath is None:
		base_full = basename
	else:
		base_full = os.path.join(basepath, basename)
	outfilename = base_full
	out_n = 1
	while os.path.exists(outfilename):
		head, tail = os.path.splitext(base_full)
		outfilename = '{}_{}{}'.format(head, out_n, tail)
		out_n += 1
	return outfilename
def unused_filename ( basename , basepath = None ) : if basepath is None : base_full = basename else : base_full = os . path . join ( basepath , basename ) outfilename = base_full out_n = 1 while os . path . exists ( outfilename ) : head , tail = os . path . splitext ( base_full ) outfilename = '{}_{}{}' . format ( head , out_n , tail ) out_n += 1 return outfilename
Generate a filename based on the basename, but which does not yet exist
Generate a filename based on the basename but which does not yet exist
"Generate a filename based on the basename, but which does not yet exist"
basename
basepath