call the method os.environ.get with 2 arguments: strings 'PATHEXT' and '.COM;.EXE;.BAT;.CMD', split the result at os.pathsep, substitute it for pathext.
pathext = os . environ . get ( 'PATHEXT' , '.COM;.EXE;.BAT;.CMD' ) . split ( os . pathsep )