Write the Rotation Matrix Values of an Object by XYZ individually?
How to make the three basic rotation matrices rotate around the x, y, or z axis.

import bpy
from math import pi
from mathutils import Vector, Matrix, Euler

theta = pi / 6

for i in range(3):
    angle = Vector()
    angle[i] = theta
    mat = Euler(angle, 'XYZ').to_matrix().to_4x4()
    print(mat, "\n")


Or directly

from math import pi, sin, cos
from mathutils import Matrix

theta = pi / 6
s = sin(theta)
c = cos(theta)

mat = Matrix()
mat[1][1] = c
mat[1][2] =-s
mat[2][1] = s
mat[2][2] = c

print(mat, "\n")