The coefficients can be obtained using the params attribute of a fitted model.
Consider the following code:
import statsmodels.api as sm
import numpy as np
np.random.seed(1)
val_x = sm.add_constant(np.arange(100))
val_ y = np.dot(val_x, [1,2]) + np.random.normal(size=100)
output = sm.OLS(val_y, val_x).fit()
print(output.params)
It will print a numpy array with the values [0.89516052 2.00334187] for the intercept and slope, respectively.
If you need more information, utilize the output.summary() object, which has three full tables with model descriptions.
Read the Artificial Intelligence tutorial to learn more about Artificial Intelligence and Machine Learning. Also, enrol in Machine Learning Course to become proficient.