Is it possible to open a script which contains a function which a button executes?
Most of Blender's core operations are not python scripts, but rather compiled C++ code. If you want to see how these are written, you can download and investigate Blender's source code.

Most addons are a different matter. They're almost all in Python, and you can usually find these in the Scripts/Addons folder under blender's installation directory (for instance in my Win7 installation: C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons).