If a,b,c are your three list for the upper diagonal, main diagonal, and lower diagonal respectively, you can write it as follows:
import numpy as np
a=[1,2,3,4]
b=[5,6,7,8,9]
c=[10,11,12,13]
n=len(b)
m=np.zeros((n,n))
for i in range(0,n-1):
m[i,i+1]=a[i]
m[i,i]=b[i]
m[i+1,i]=c[i]
m[n-1,n-1]=b[n-1]
print(m)
In the code above you initialize a zero matrix, and then update only the upper,lower, and main diagonal entries according to your lists.
The output is
[[ 5. 1. 0. 0. 0.]
[ 10. 6. 2. 0. 0.]
[ 0. 11. 7. 3. 0.]
[ 0. 0. 12. 8. 4.]
[ 0. 0. 0. 13. 9.]]
Edit: A shorter way, suggested by @hpaulj would be
m=np.diag(a,1)+np.diag(b,0)+np.diag(c,-1)
np.diag(r,k) create a matrix in which the k'th diagonal above the main diagonal (below if k is negative) is r and the rest of the entries are 0.
See documentation here:
https://docs.scipy.org/doc/numpy/reference/generated/numpy.diag.html
scipy.sparsehas a couple of ways of setting multiple diagonals at once. Thenumpy.diagsets one diagonal at a time, but otherwise is easy to use.