I am trying to write theta in a specific format to a .txt file. I present the current and expected output.
import numpy as np
theta = np.pi/3
with open('Contact angle.txt', 'w+') as f:
f.write(f"theta = {str(theta)}\n")
The current output is
theta = 1.0471975511965976
The expected output is
theta = pi/3
f.write("theta = pi/3 \n")thetaand I want it to write automatically to the txt file in this format.theta = 1.1?