Could someone help me or share some code to auto fill a login with mechanize (http://wwwsearch.sourceforge.net/mechanize/)? I want to make a python script to log me into my
Each of your favorite sites probably has different forms (form number, and names of user and password fields) and one hopes you use different usernames and passwords on each (using the same user and password on many sites means that if one of the sites is cracked, your identity is now compromised "everywhere" -- quite a mess!).
So, you can either hardcode all of these parameters, as in @systempuntoout's answer, or write a little configuration text file (for example in the format supported by ConfigParser) with all this info for each site, so that you can load the configuration when your script starts, and write a "log_me_in" function, just once, that takes the sitename as the parameter and looks up and uses the parameters that depend on it.
If you have a lot of "favorite sites", so that loading all their info perceptibly slows your startup time, then you may even want to consider persisting that info more smartly (e.g. in a sqlite table) so it can be looked up rapidly for just one or a few sites given their names as the "key" to use.