File I/O¶
Using read
and save
to perform basic file I/O operations in PromptScript.
PromptScript currently only supports basic file I/O operations on non-binary files.
Reading Files¶
To read the content of files, use the read
command
read file_path
Parameters
file_path (str: required): File path to read from.
Output
str: The file’s text content.
Writing Files¶
To write to files, use the save
command
save content, file_path
Parameters
content (str: required): Text to write to file.
file_path (str: required): File path to read from.
Output
None.
Example Usage¶
1message = "File Content"
2
3save message, "file.txt"
4show [read "file.txt"]
Output: File Content