First of all, sampling frequency and sampling rate are synonymous. You mean sampling frequency of 44.1 kHz with a data length of 20 ms.
Second of all, 20 ms of data at 44.1 kHz will give you 882 points. Not enough for a 1024-point FFT.
You will either need to upsample to 51.2 kHz, that way 20 ms will give you 1024 points. Or you could append 142 zeroes to your data. Or, you could simply compute your FFT with the 882 points that you have. All 3 methods, will give you the same information. I personnaly recommend that you simply compute your FFT on 882 points.
As to the actual syntax, just google it, there are some pretty good examples.
edit : This seems like a good place to start
https://www.oreilly.com/library/view/elegant-scipy/9781491922927/ch04.html