thdl.utils.file
¶
-
thdl.utils.file.
write_xls
(contents, filepath)[source]¶ Write the contents into the xls tables.
Parameters: - contents – an instance of
dict
or an instance oflist
. If isinstance(contents, dict) == True, there is only one line in xls table. If contents is a list, then there are several lines in xls table. - filepath –
str
instance. The path to save.
- contents – an instance of
-
thdl.utils.file.
pickle_dump
(data, path)[source]¶ Given the DATA, then pickle it into the PATH.
Parameters: - data – the f_data to pickle.
- path – the path to store the pickled f_data.
-
thdl.utils.file.
pickle_load
(path)[source]¶ From the PATH get the DATA.
Parameters: path – the path that store the pickled f_data
-
thdl.utils.file.
check_duplicate_path
(filepath)[source]¶ Check the duplicate path.
If there is a same filepath, for example ‘file/tests.txt’, Then this path will be ‘file/tests(1).txt’
If ‘file/tests(1).txt’ also exists, then this path will be ‘file/tests(2).txt’
Parameters: filepath – the file path to save. Returns: the file path can be used to save path.