fusetools.text_tools.Export¶
-
class
fusetools.text_tools.Export[source]¶ Bases:
objectFunctions for exporting Python text objects.
Methods
Concatenates contents of specified files into a target file and saves it.
Exports a Python dictionary object to a JSON file.
Exports a Python string object to a SQL file.
Finds and replaces a string in all text files in a target folder.
-
classmethod
concat_text_files(input_files, output_file)[source]¶ Concatenates contents of specified files into a target file and saves it.
- Parameters
input_files – List of text files to concatenate.
output_file – Target output file.
- Returns
Concatenated target output file.
-
classmethod
dump_json(obj, filepath)[source]¶ Exports a Python dictionary object to a JSON file.
- Parameters
obj – Python dictionary object.
filepath – Filepath to save object to.
- Returns
Exported JSON file.
-
classmethod
dump_sql(obj, filepath)[source]¶ Exports a Python string object to a SQL file.
- Parameters
obj – Python string object.
filepath – Filepath to save object to.
- Returns
Exported SQL file.
-
classmethod
find_replace_text(directory, find, replace, file_pattern, specific_file=False)[source]¶ Finds and replaces a string in all text files in a target folder.
- Parameters
directory – Target folder containing files.
find – String to search for.
replace – New string to replace with.
file_pattern – Pattern of text files to scan.
- Returns
Saved files with replaced text.
-
classmethod