The page you linked uses os.popen()(official docs here)
In windows, you should use "tasklist" as arg for os.popen(), rather than "ps -Af"
e.g.
>>> import os
>>> tmp = os.popen("tasklist").read() # it would return a str type
>>> "python.exe" in tmp
True