You question is very generic.
To read:
# Read a file from the workspace
with open("/dbfs/workspace/<folder>/<file>.txt", "r") as file:
content = file.read()
print(content)
To write:
# Write a file to the workspace
with open("/dbfs/workspace/<folder>/<file>.txt", "w") as file:
file.write("This is a test file.")
Sometime I use dbutils API, here is some examples:
# Write a file to the workspace
dbutils.fs.put("workspace:/shared_folder/example.txt", "This is a test file.")
# Read the file
content = dbutils.fs.head("workspace:/shared_folder/example.txt")
print(content)
Lets me know if above is not working, I will help more. Cheers