Styleguide/Scripts: Difference between revisions

From Donate
Jump to navigation Jump to search
Content deleted Content added
Cbarr (talk | contribs)
Cbarr (talk | contribs)
 
(2 intermediate revisions by the same user not shown)
Line 941: Line 941:
==Google currency conversion mining code==
==Google currency conversion mining code==
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>

using namespace std;

long calculateDigits(double d)
{
long result = 0;
long temp = d;
long place = 1;

while(temp/place)
{
place *= 10;
result++;
}
return(result);
}

int main()
{
string website = "http://www.google.com/finance/";
string file = "converter?a=1&from=USD&to=";
string currency;

ofstream out;
ifstream currencyFile;

out.open("Google/ratesGoogle.txt");
currencyFile.open("currencyCodesAll.txt");

while(currencyFile >> currency)
{
string command = "wget '" + website + file + currency
+ "' && grep 'currency_converter_result' '"
+ file + currency + "' > 'resultGoogle.grep'";

system(command.c_str());
ifstream in("resultGoogle.grep");
string result;

getline(in,result,'\n');

in.close();

system("rm resultGoogle.grep");

result.erase(0,58);

bool remove = false;
for(long i = 0 ; i < result.size() ; i++)
{
if(result[i] == ' ')
remove = true;
if(remove)
result[i] = ' ';
}

if(result != "")
out << currency << " " << result << endl;
}
system("rm conv*");
out.close();
currencyFile.close();

vector<string> currencyList;
vector<double> rateList;

double rate;

ifstream in("Google/ratesGoogle.txt");

while(in >> currency && in >> rate)
{
rate = ceil(rate*100)/100.0;
currencyList.push_back(currency);
rateList.push_back(rate);
}

in.close();

unsigned options[16] = {1,2,3,5,10,15,20,25,30,35,50,75,100,150,200,250};

vector <vector <double> > currencyOptions;
currencyOptions.resize(rateList.size());

for(long i = 0 ; i < currencyOptions.size() ; i++)
{
currencyOptions[i].resize(16);
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
currencyOptions[i][j] = rateList[i]*options[j];
}
}

// ===================== raw table ==============================
out.open("Google/currencyOptionsRawGoogle.csv");

out << "USD, rate,";
for(long j=0 ; j < 16 ; j++)
{
out << options[j] << ", ";
}
out << endl;

for(long i = 0 ; i < currencyOptions.size() ; i++)
{
out << currencyList[i] << ", " << rateList[i] << ", ";
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
out << currencyOptions[i][j] << ", ";
}
out << endl;
}

out.close();

// ================== rounded to nearest dollar ====================

for(long i = 0 ; i < currencyOptions.size() ; i++)
for(long j=0 ; j < currencyOptions[i].size() ; j++)
currencyOptions[i][j] = ceil(currencyOptions[i][j]);

out.open("Google/currencyOptionsRoundedGoogle.csv");

out << "USD, rate,";
for(long j=0 ; j < 16 ; j++)
{
out << options[j] << ", ";
}
out << endl;

for(long i = 0 ; i < currencyOptions.size() ; i++)
{
out << currencyList[i] << ", " << rateList[i] << ", ";
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
out << (long)currencyOptions[i][j] << ", ";
}
out << endl;
}

out.close();

// =================== zero bottom 1% digits =========================
double temp;
long digits;

for(long i = 0 ; i < currencyOptions.size() ; i++)
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
temp = currencyOptions[i][j];
digits = calculateDigits(temp);

if(digits < 3)
{}
else
{
temp /= (long)(pow(10,digits-3));
temp = ceil(temp);
temp *= (long)(pow(10,digits-3));
currencyOptions[i][j] = (long)temp;
}
}

out.open("Google/currencyOptionsZeroBottomGoogle.csv");

out << "USD, rate,";
for(long j=0 ; j < 16 ; j++)
{
out << options[j] << ", ";
}
out << endl;

for(long i = 0 ; i < currencyOptions.size() ; i++)
{
out << currencyList[i] << ", " << rateList[i] << ", ";
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
out << (long)currencyOptions[i][j] << ", ";
}
out << endl;
}

out.close();

// =================== zero bottom 1% digits 5-ify =========================

long ones;

for(long i = 0 ; i < currencyOptions.size() ; i++)
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
temp = currencyOptions[i][j];
digits = calculateDigits(temp);

if(digits == 1)
{
//temp /= 5;
//temp = round(temp);
//temp *= 5;
//currencyOptions[i][j] = temp;
}
else
{
if(digits > 3)
temp /= (long)(pow(10,digits-3));

ones = (long)(temp)%10;
temp = temp - ones;
if(ones > 0 and ones <= 5)
{
temp += 5;
}
else if(ones > 6 and ones <= 9)
{
temp += 10;
}
if(digits > 3)
temp *= (long)(pow(10,digits-3));

currencyOptions[i][j] = (long)temp;
}
}

out.open("Google/currencyOptions5ifyGoogle.csv");

out << "USD, rate,";
for(long j=0 ; j < 16 ; j++)
{
out << options[j] << ", ";
}
out << endl;

for(long i = 0 ; i < currencyOptions.size() ; i++)
{
out << currencyList[i] << ", " << rateList[i] << ", ";
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
out << (long)currencyOptions[i][j] << ", ";
}
out << endl;
}

out.close();

return 0;
}

</syntaxhighlight>
</syntaxhighlight>


==Bloomberg currency conversion mining code==
==Bloomberg currency conversion mining code==
<syntaxhighlight lang="cpp">
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>

using namespace std;

long calculateDigits(double d)
{
long result = 0;
long temp = d;
long place = 1;

while(temp/place)
{
place *= 10;
result++;
}
return(result);
}

int main()
{
string website = "http://www.bloomberg.com/personal-finance/calculators/currency-converter/";
string currency;

ofstream out;

out.open("Bloomberg/ratesBloomberg.txt");

string command = "wget '" + website
+ "' && grep \":CUR\'\" 'index.html' > 'resultBloomberg.grep'";
system(command.c_str());

ifstream in("resultBloomberg.grep");
string result;

while(getline(in,result,'\n'))
{

string tempString;

result.erase(0,23);
tempString = result.substr(0,3);
result.erase(0,12);
result.erase(result.end()-1,result.end());

if(result != "")
out << tempString << " " << result << endl;
}

in.close();
system("rm resultBloomberg.grep");
system("rm inde*");
out.close();

vector<string> currencyList;
vector<double> rateList;

double rate;

in.open("Bloomberg/ratesBloomberg.txt");

while(in >> currency && in >> rate)
{
rate = ceil(rate*100)/100.0;
currencyList.push_back(currency);
rateList.push_back(rate);
}

in.close();

unsigned options[17] = {1,2,3,5,10,15,20,25,30,35,50,75,100,150,200,250,29500000};

vector <vector <double> > currencyOptions;
currencyOptions.resize(rateList.size());

for(long i = 0 ; i < currencyOptions.size() ; i++)
{
currencyOptions[i].resize(17);
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
currencyOptions[i][j] = rateList[i]*options[j];
}
}

// ===================== raw table ==============================
out.open("Bloomberg/currencyOptionsRawBloomberg.csv");

out << "USD, rate,";
for(long j=0 ; j < 17 ; j++)
{
out << options[j] << ", ";
}
out << endl;

for(long i = 0 ; i < currencyOptions.size() ; i++)
{
out << currencyList[i] << ", " << rateList[i] << ", ";
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
out << currencyOptions[i][j] << ", ";
}
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
out << (long)currencyOptions[i][j] << " ";
}
out << endl;
}

out.close();

// ================== rounded to nearest dollar ====================

for(long i = 0 ; i < currencyOptions.size() ; i++)
for(long j=0 ; j < currencyOptions[i].size() ; j++)
currencyOptions[i][j] = ceil(currencyOptions[i][j]);

out.open("Bloomberg/currencyOptionsRoundedBloomberg.csv");

out << "USD, rate,";
for(long j=0 ; j < 17 ; j++)
{
out << options[j] << ", ";
}
out << endl;

for(long i = 0 ; i < currencyOptions.size() ; i++)
{
out << currencyList[i] << ", " << rateList[i] << ", ";
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
out << (long)currencyOptions[i][j] << ", ";
}
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
out << (long)currencyOptions[i][j] << " ";
}
out << endl;
}

out.close();

// =================== zero bottom 1% digits =========================
double temp;
long digits;

for(long i = 0 ; i < currencyOptions.size() ; i++)
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
temp = currencyOptions[i][j];
digits = calculateDigits(temp);

if(digits < 4)
{}
else
{
temp /= (long)(pow(10,digits-3));
temp = ceil(temp);
temp *= (long)(pow(10,digits-3));
currencyOptions[i][j] = (long)temp;
}
}

out.open("Bloomberg/currencyOptionsZeroBottomBloomberg.csv");

out << "USD, rate,";
for(long j=0 ; j < 17 ; j++)
{
out << options[j] << ", ";
}
out << endl;

for(long i = 0 ; i < currencyOptions.size() ; i++)
{
out << currencyList[i] << ", " << rateList[i] << ", ";
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
out << (long)currencyOptions[i][j] << ", ";
}
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
out << (long)currencyOptions[i][j] << " ";
}
out << endl;
}

out.close();

// =================== zero bottom 1% digits 5-ify =========================
long ones;

for(long i = 0 ; i < currencyOptions.size() ; i++)
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
temp = currencyOptions[i][j];
digits = calculateDigits(temp);

if(digits == 1)
{
//temp /= 5;
//temp = round(temp);
//temp *= 5;
//currencyOptions[i][j] = temp;
}
else
{
if(digits > 3)
temp /= (long)(pow(10,digits-3));

ones = (long)(temp)%10;
temp = temp - ones;
if(ones > 0 and ones <= 5)
{
temp += 5;
}
else if(ones >= 6 and ones <= 9)
{
temp += 10;
}
if(digits > 3)
temp *= (long)(pow(10,digits-3));

currencyOptions[i][j] = (long)temp;
}
}

out.open("Bloomberg/currencyOptions5ifyBloomberg.csv");

out << "USD, rate,";
for(long j=0 ; j < 17 ; j++)
{
out << options[j] << ", ";
}
out << endl;

for(long i = 0 ; i < currencyOptions.size() ; i++)
{
out << currencyList[i] << ", " << rateList[i] << ", ";
for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
out << (long)currencyOptions[i][j] << ", ";
}

for(long j=0 ; j < currencyOptions[i].size() ; j++)
{
out << (long)currencyOptions[i][j] << " ";
}
out << ", ";

out << "\"" << (long)currencyOptions[i][3] << " "
<< (long)currencyOptions[i][4] << " "
<< (long)currencyOptions[i][6] << " "
<< (long)currencyOptions[i][9] << " "
<< (long)currencyOptions[i][10] << " "
<< (long)currencyOptions[i][12] << " "
<< (long)currencyOptions[i][15] << "\"" << endl;
}

out.close();

return 0;
}

</syntaxhighlight>

Latest revision as of 15:04, 3 February 2012

Introduction

"Form-countryspecific-*" creating code

import wikipedia
wiki = wikipedia
site = wiki.getSite('en', 'wikidonate')

basetitle   = 'Template:2012FR/Form-countryspecific-control'
editsummary = 'Updating localized landing page via python script.'
overwrite   = True   # overwrite a page if it already exists? True/False (must be capitalised)

## list of countries and amounts. Watch the commas!
optionAmounts = {
'':[10,20,25,35,50,75,100],
'/JP':[1000,1500,2000,3000,5000,10000,15000],
'/ST':[10,20,30,50,75,100,150],
'/SR':[5,10,20,40,55,75,180],
'/SV':[45,90,175,310,440,875,2200],
'/SI':[5,10,20,50,75,100,150],
'/SK':[5,10,20,50,75,100,150],
'/SM':[5,10,20,40,55,75,180],
'/SN':[2500,5000,10000,20000,30000,50000,100000],
'/SA':[50,100,200,500,750,1000,1500],
'/JO':[5,10,20,35,50,75,200],
'/SC':[100,150,300,500,1000,2000,3000],
'/JM':[400,850,1750,4500,6500,9000,20000],
'/SE':[50,100,150,250,500,750,1000],
'/SD':[5,10,15,30,50,75,150],
'/SG':[10,20,50,75,100,150,300],
'/CI':[5,10,20,40,55,75,180],
'/CH':[10,20,25,35,50,75,100],
'/CK':[5,10,20,50,75,100,250],
'/CM':[2500,5000,10000,20000,30000,50000,100000],
'/CL':[2500,5000,10000,20000,30000,50000,100000],
'/CO':[10000,20000,50000,75000,100000,150000,200000],
'/CN':[50,75,100,300,500,1000,1500],
'/CA':[5,10,20,25,50,100,250],
'/CG':[5,10,20,50,75,100,250],
'/CF':[2500,5000,10000,20000,30000,50000,100000],
'/CY':[5,10,20,50,75,100,150],
'/CZ':[100,150,300,1000,1500,2000,3000],
'/CR':[2500,5000,10000,20000,50000,75000,100000],
'/CV':[5,10,20,40,55,75,180],
'/DZ':[350,700,1500,3500,5000,7500,15000],
'/DJ':[5,10,20,50,75,100,250],
'/DK':[50,100,150,200,300,500,750],
'/DM':[25,50,100,150,200,300,500],
'/DO':[200,500,1000,2000,5000,7500,10000],
'/DE':[10,20,30,40,50,75,100],
'/SB':[5,10,20,50,75,100,250],
'/ZA':[25,50,100,300,500,750,1000],
'/MC':[5,10,20,40,55,75,180],
'/MA':[40,75,150,400,600,800,2000],
'/MH':[5,10,20,50,75,100,250],
'/MG':[5,10,20,40,55,75,180],
'/ME':[5,10,20,40,55,75,180],
'/MD':[5,10,20,50,75,100,250],
'/MK':[250,500,1000,2000,3000,4000,5000],
'/USD':[10,20,25,35,50,75,100],
'/ZM':[5,10,20,50,75,100,250],
'/MO':[5,10,20,25,50,100,250],
'/ML':[2500,5000,10000,20000,30000,50000,100000],
'/MR':[5,10,20,50,75,100,250],
'/MP':[5,10,20,50,75,100,250],
'/MW':[5,10,15,30,50,75,150],
'/MV':[100,200,300,500,1000,1500,4000],
'/MU':[10,20,25,35,50,75,100],
'/MT':[5,10,20,50,75,100,150],
'/MZ':[5,10,20,50,75,100,250],
'/MY':[20,30,50,100,200,300,500],
'/MX':[100,150,200,500,750,1000,2000],
'/ZW':[5,10,20,50,75,100,250],
'/FJ':[10,20,30,50,100,200,500],
'/FI':[5,10,20,25,50,100,250],
'/FO':[50,100,150,200,300,500,750],
'/FM':[5,10,20,50,75,100,250],
'/FR':[10,20,30,50,75,100,150],
'/TH':[100,250,500,750,1000,2000,3000],
'/TM':[150,300,600,1500,2250,3000,7500],
'/TN':[10,15,30,75,100,150,350],
'/TO':[5,10,20,50,75,100,250],
'/OM':[4,5,10,25,30,50,100],
'/TD':[2500,5000,10000,20000,30000,50000,100000],
'/TG':[2500,5000,10000,20000,30000,50000,100000],
'/TZ':[5,10,20,50,75,100,250],
'/TP':[5,10,20,50,75,100,250],
'/TR':[10,25,50,100,150,200,500],
'/TT':[35,75,150,300,450,650,1600],
'/TW':[150,300,500,1000,1500,2000,5000],
'/PW':[5,10,20,50,75,100,250],
'/KW':[2,5,10,15,25,30,75],
'/IN':[100,200,300,500,1000,2000,3000],
'/IL':[25,50,100,200,300,500,1000],
'/VU':[5,10,20,50,75,100,250],
'/IE':[5,10,20,50,75,100,150],
'/ID':[50000,75000,100000,150000,200000,500000,1000000],
'/VC':[5,10,20,50,75,100,250],
'/VA':[5,10,20,40,55,75,180],
'/VE':[5,10,20,50,75,100,250],
'/VI':[5,10,20,50,75,100,250],
'/IS':[5,10,20,50,75,100,250],
'/IQ':[5,10,20,50,75,100,250],
'/EUR':[10,20,25,35,50,100,200],
'/YE':[5,10,20,50,75,100,250],
'/KI':[5,10,20,50,75,100,250],
'/BN':[5,10,20,50,75,100,250],
'/BO':[40,75,145,250,355,705,1800],
'/BM':[5,10,20,35,50,100,250],
'/BJ':[2500,5000,10000,20000,30000,50000,100000],
'/BH':[4,5,10,25,40,50,100],
'/BI':[5,10,20,50,75,100,250],
'/BF':[2500,5000,10000,20000,30000,50000,100000],
'/BG':[10,25,50,75,100,150,200],
'/BD':[350,800,1500,3000,6000,10000,20000],
'/BE':[5,10,20,25,50,100,250],
'/BB':[10,20,50,100,200,300,500],
'/BA':[5,10,20,40,55,75,180],
'/KM':[5,10,20,50,75,100,250],
'/BZ':[10,20,50,75,100,250,500],
'/BY':[5,10,20,40,55,75,180],
'/BW':[5,10,20,50,75,100,250],
'/KN':[25,50,100,150,200,300,500],
'/BR':[10,20,50,100,150,200,500],
'/BS':[5,10,20,35,50,100,250],
'/PT':[5,10,20,50,100,150,200],
'/KP':[5,10,20,50,75,100,250],
'/KR':[10000,15000,20000,30000,50000,75000,100000],
'/PR':[5,10,20,50,75,100,250],
'/PS':[5,10,20,50,75,100,250],
'/KZ':[750,1500,3000,7500,12000,15000,35000],
'/PY':[21000,42000,84000,210000,315000,420000,1050000],
'/PE':[15,30,50,150,100,275,700],
'/PG':[5,10,20,50,75,100,250],
'/KE':[500,1000,2000,5000,7500,10000,25000],
'/PA':[5,10,20,50,75,100,250],
'/PL':[20,35,50,75,100,150,300],
'/KH':[5,10,20,50,75,100,250],
'/PH':[200,500,750,1000,2000,3000,5000],
'/PK':[500,750,1500,4000,6500,10000,22000],
'/LB':[7500,15000,30000,75000,120000,175000,350000],
'/LC':[25,50,100,150,200,300,500],
'/LI':[5,10,20,50,75,100,250],
'/UA':[50,75,150,300,500,750,1000],
'/LK':[500,1000,2500,5000,8500,10000,25000],
'/UZ':[150,300,600,1500,2250,3000,7500],
'/UY':[100,200,400,1000,1500,1950,5000],
'/LT':[15,25,50,100,200,250,600],
'/LU':[5,10,20,25,50,100,250],
'/LV':[5,10,20,30,40,50,75],
'/US':[5,10,20,25,50,100,250],
'/LY':[5,10,20,40,55,75,180],
'/ES':[5,10,20,50,100,150,200],
'/ER':[5,10,20,50,75,100,250],
'/RU':[100,150,200,500,1000,2000,3000],
'/RS':[5,10,20,35,50,75,100],
'/ET':[5,10,20,50,75,100,250],
'/RO':[25,50,75,100,200,300,500],
'/EC':[5,10,20,35,50,100,250],
'/RE':[5,10,20,40,55,75,180],
'/EG':[20,50,150,300,450,700,1500],
'/EE':[5,10,20,35,50,75,100],
'/NI':[100,250,500,1000,1500,2500,5500],
'/NO':[50,100,150,250,500,750,1000],
'/NL':[5,10,20,50,100,200,300],
'/NA':[5,10,20,50,75,100,250],
'/NG':[5,10,20,50,75,100,250],
'/NE':[2500,5000,10000,20000,30000,50000,100000],
'/NZ':[5,10,20,25,50,100,250],
'/NR':[5,10,20,50,75,100,250],
'/NP':[250,500,1000,2500,3750,5000,1000],
'/IT':[5,10,20,50,100,150,200],
'/VN':[100000,200000,450000,1000000,1600000,2100000,5000000],
'/GQ':[5,10,20,25,50,100,250],
'/GU':[5,10,20,50,75,100,250],
'/GW':[5,10,20,25,50,100,250],
'/GT':[50,100,150,300,500,750,2000],
'/GR':[5,10,20,50,75,100,150],
'/GM':[5,10,20,50,75,100,250],
'/GL':[50,100,150,200,300,500,750],
'/GE':[5,10,20,50,75,100,250],
'/GD':[25,50,100,150,200,300,500],
'/GF':[5,10,20,40,55,75,180],
'/GA':[2500,5000,10000,20000,30000,50000,100000],
'/GB':[10,20,15,30,50,75,150],
'/LR':[5,10,20,50,75,100,250],
'/HN':[100,200,400,1000,1500,2000,4500],
'/HK':[100,200,300,500,1000,1500,2000],
'/QA':[20,50,75,185,250,350,1000],
'/HU':[1000,2000,5000,10000,20000,50000,100000],
'/HR':[35,50,100,250,500,1000,1500],
'/XX':[5,10,20,25,50,100,250],
'/AG':[25,50,100,150,200,300,500],
'/AF':[5,10,20,50,75,100,250],
'/AE':[25,50,100,200,300,500,1000],
'/AD':[5,10,20,50,75,100,150],
'/AO':[5,10,20,50,75,100,250],
'/AN':[10,20,30,50,100,200,500],
'/AM':[5,10,20,40,55,75,180],
'/AL':[5,10,20,50,75,100,150],
'/AW':[5,10,20,40,55,75,180],
'/AU':[5,10,20,25,50,100,250],
'/AT':[5,10,20,25,50,100,250],
'/AS':[5,10,20,50,75,100,250],
'/AR':[25,50,100,200,500,750,1000],
'/AZ':[5,10,20,40,55,75,180]
}

##This array stores what buttons should be shown
##[cc-vm,obt-bp,rtbt-ideal,rtbt-eps,rtbt-sofo,dd,ew-pp,ew-rpp,ew-pp-usd,ew-yd,ew-mb,ew-wm,bt]
paymentButtons={
'':['cc-vm','ew-pp'],
'/USD':['cc-vm','ew-pp'],
'/EUR':['cc-vm','ew-pp'],
'/XX':['cc-vm','ew-pp'],
'/AD':['cc-vmaj','ew-pp'],
'/AE':['cc-vma','bt'],
'/AF':['cc-vm','ew-pp'],
'/AG':['cc-vm','ew-pp-usd'],
'/AL':['cc-vma','ew-pp'],
'/AM':['cc-vm','ew-pp'],
'/AN':['cc-vma','ew-pp-usd'],
'/AO':['cc-vm','ew-pp'],
'/AR':['cc-vm','ew-pp-usd'],
'/AS':['cc-vmaj','ew-pp'],
'/AT':['cc-vmaj','rtbt-eps','rtbt-sofo','ew-pp','bt'],
'/AU':['cc-vmaj','ew-pp','obt-bp','bt'],
'/AW':['cc-vm','ew-pp'],
'/AZ':['cc-vm','ew-pp'],
'/BA':['cc-vm','ew-pp'],
'/BB':['cc-vm','ew-pp-usd'],
'/BD':['cc-vm'],
'/BE':['cc-vmaj','rtbt-sofo','ew-pp','bt'],
'/BF':['cc-vma','ew-pp-usd'],
'/BG':['cc-vma','ew-mb','bt'],
'/BH':['cc-vmaj','bt'],
'/BI':['cc-vm','ew-pp'],
'/BJ':['cc-vma','ew-pp-usd'],
'/BM':['cc-vm','ew-pp-usd'],
'/BN':['cc-vm','ew-pp'],
'/BO':['cc-vm'],
'/BR':['cc-vmj','ew-pp-usd'],
'/BS':['cc-vm','ew-pp-usd'],
'/BW':['cc-vm','ew-pp'],
'/BY':['cc-vm','ew-pp'],
'/BZ':['cc-vm','ew-pp-usd'],
'/CA':['cc-vm','ew-pp'],
'/CF':['cc-vm','ew-pp-usd'],
'/CG':['cc-vm','ew-pp'],
'/CH':['cc-vma','ew-pp'],
'/CI':['cc-vm','ew-pp'],
'/CK':['cc-vma','ew-pp-usd'],
'/CL':['cc-vm','ew-pp-usd','bt'],
'/CM':['cc-vm','ew-pp-usd'],
'/CN':['cc-vma'],
'/CO':['cc-vm','ew-pp-usd'],
'/CR':['cc-vma','ew-pp-usd'],
'/CV':['cc-vm','ew-pp'],
'/CY':['cc-vma','ew-pp'],
'/CZ':['cc-vma','ew-pp','ew-mb','bt'],
'/DE':['cc-vmaj','ew-pp','bt'],
'/DJ':['cc-vm','ew-pp'],
'/DK':['cc-vma','ew-pp','bt'],
'/DM':['cc-vm','ew-pp-usd'],
'/DO':['cc-vm','ew-pp-usd'],
'/DZ':['cc-vma'],
'/EC':['cc-vmaj','ew-pp','bt'],
'/EE':['cc-vma','ew-pp','bt'],
'/EG':['cc-vma','bt'],
'/ER':['cc-vm','ew-pp'],
'/ES':['cc-vmaj','ew-pp','bt'],
'/ET':['cc-vm','ew-pp'],
'/FI':['cc-vmaj','ew-pp','ew-wm'],
'/FJ':['cc-vma','ew-pp-usd'],
'/FM':['cc-vmaj','ew-pp'],
'/FO':['cc-vma','ew-pp'],
'/FR':['cc-vmaj','ew-pp','bt'],
'/GA':['cc-vm','ew-pp-usd'],
'/GB':['cc-vmaj','ew-pp'],
'/GD':['cc-vm','ew-pp-usd'],
'/GE':['cc-vm','ew-pp'],
'/GF':['cc-vmaj','ew-pp'],
'/GL':['cc-vma','ew-pp-usd'],
'/GM':['cc-vm','ew-pp'],
'/GR':['cc-vmaj','ew-pp'],
'/GT':['cc-vm'],
'/GQ':['cc-vm','ew-pp'],
'/GU':['cc-vmaj','ew-pp'],
'/GW':['cc-vm','ew-pp'],
'/HK':['cc-vmaj','ew-pp'],
'/HN':['cc-vm','ew-pp-usd'],
'/HR':['cc-vma','bt'],
'/HU':['cc-vma','ew-pp','bt'],
'/ID':['cc-vmj','ew-pp-usd'],
'/IE':['cc-vmaj','ew-pp'],
'/IL':['cc-vma','ew-pp'],
'/IN':['cc-vm','ew-pp-usd'],
'/IQ':['cc-vm','ew-pp'],
'/IS':['cc-vm','ew-pp'],
'/IT':['cc-vmaj','ew-pp','ew-mb','bt'],
'/JM':['cc-vm'],
'/JO':['cc-vma'],
'/JP':['cc-vmaj','ew-pp','bt'],
'/KE':['cc-vma','ew-pp-usd'],
'/KH':['cc-vm','ew-pp'],
'/KI':['cc-vmaj','ew-pp'],
'/KM':['cc-vm','ew-pp'],
'/KN':['cc-vm','ew-pp'],
'/KP':['cc-vm','ew-pp'],
'/KR':['cc-vmaj','ew-pp-usd'],
'/KW':['cc-vma'],
'/KZ':['cc-vma'],
'/LB':['cc-vma','bt'],
'/LC':['cc-vm','ew-pp-usd'],
'/LI':['cc-vma','ew-pp-usd'],
'/LK':['cc-vma'],
'/LR':['cc-vm','ew-pp'],
'/LT':['cc-vma','ew-pp-usd'],
'/LU':['cc-vmaj','ew-pp','bt'],
'/LV':['cc-vma','ew-pp-usd'],
'/LY':['cc-vm','ew-pp'],
'/MA':['cc-vma'],
'/MC':['cc-vmaj','ew-pp'],
'/MD':['cc-vm','ew-pp'],
'/ME':['cc-vmaj','ew-pp'],
'/MG':['cc-vm','ew-pp'],
'/MH':['cc-vmaj','ew-pp'],
'/MK':['cc-vm','ew-pp-usd'],
'/ML':['cc-vma','ew-pp-usd'],
'/MO':['cc-vm','ew-pp'],
'/MP':['cc-vm','ew-pp'],
'/MR':['cc-vm','ew-pp'],
'/MT':['cc-vma','ew-pp'],
'/MU':['cc-vm','ew-pp-usd'],
'/MV':['cc-vm','ew-pp-usd'],
'/MW':['cc-vm','ew-pp'],
'/MX':['cc-vm','ew-pp','bt'],
'/MY':['cc-vmaj','ew-pp-usd','bt'],
'/MZ':['cc-vm','ew-pp'],
'/NA':['cc-vm','ew-pp'],
'/NE':['cc-vma','ew-pp-usd'],
'/NG':['cc-vm','ew-pp'],
'/NI':['cc-vm'],
'/NL':['cc-vmaj','rtbt-ideal','ew-pp','bt'],
'/NO':['cc-vma','ew-pp','bt'],
'/NP':['cc-vm'],
'/NR':['cc-vmaj','ew-pp'],
'/NZ':['cc-vma','ew-pp','bt'],
'/OM':['cc-vma'],
'/PA':['cc-vm'],
'/PE':['cc-vm','bt'],
'/PG':['cc-vm','ew-pp'],
'/PH':['cc-vm','ew-pp'],
'/PK':['cc-vma'],
'/PL':['cc-vma','ew-pp','bt'],
'/PR':['cc-vmaj','ew-pp'],
'/PS':['cc-vm','ew-pp'],
'/PT':['cc-vmaj','ew-pp','bt'],
'/PW':['cc-vm','ew-pp'],
'/PY':['cc-vm'],
'/QA':['cc-vma','bt'],
'/RE':['cc-vmaj','ew-pp'],
'/RO':['cc-vma','bt','ew-pp-usd'],
'/RS':['cc-vm','ew-pp'],
'/RU':['cc-vma','ew-wm','bt'],
'/SA':['cc-vma','ew-pp-usd'],
'/SB':['cc-vm','ew-pp'],
'/SC':['cc-vma','ew-pp-usd'],
'/SD':['cc-vm','ew-pp'],
'/SE':['cc-vma','ew-pp','bt'],
'/SG':['cc-vmaj','ew-pp'],
'/SI':['cc-vmaj','ew-pp','bt'],
'/SK':['cc-vmaj','ew-pp','bt'],
'/SM':['cc-vmaj','ew-pp'],
'/SN':['cc-vma','ew-pp-usd'],
'/SR':['cc-vm','ew-pp'],
'/SV':['cc-vm','ew-pp-usd'],
'/ST':['cc-vm','ew-pp'],
'/TD':['cc-vm','ew-pp-usd'],
'/TG':['cc-vma','ew-pp-usd'],
'/TH':['cc-vmaj','ew-pp'],
'/TM':['cc-vm'],
'/TN':['cc-vma'],
'/TO':['cc-vm','ew-pp'],
'/TP':['cc-vm','ew-pp'],
'/TR':['cc-vma','ew-pp-usd','bt'],
'/TT':['cc-vm'],
'/TW':['cc-vmaj','ew-pp','bt'],
'/TZ':['cc-vm','ew-pp'],
'/UA':['cc-vma','ew-pp-usd'],
'/US':['cc-vmaj','ew-pp'],
'/UY':['cc-vm'],
'/UZ':['cc-vm'],
'/VA':['cc-vmaj','ew-pp'],
'/VC':['cc-vm','ew-pp'],
'/VE':['cc-vm','ew-pp'],
'/VI':['cc-vmaj','ew-pp'],
'/VN':['cc-vm'],
'/VU':['cc-vm','ew-pp'],
'/YE':['cc-vm','ew-pp'],
'/ZA':['cc-vm','ew-pp-usd','ew-mb','bt'],
'/ZM':['cc-vm','ew-pp'],
'/ZW':['cc-vm','ew-pp']
}

##This array stores what payment processor to use
##(GC - Global Collect or PF - PayFlow)
paymentProcessing={
'':['GC'],
'/USD':['GC'],
'/EUR':['GC'],
'/XX':['GC'],
'/AE':['GC'],
'/AN':['GC'],
'/AR':['GC'],
'/PG':['GC'],
'/KI':['GC'],
'/NR':['GC'],
'/VU':['GC'],
'/AU':['GC'],
'/BD':['GC'],
'/BG':['GC'],
'/BH':['GC'],
'/BM':['GC'],
'/BO':['GC'],
'/BR':['GC'],
'/BZ':['GC'],
'/CA':['GC'],
'/LI':['GC'],
'/CH':['GC'],
'/CL':['GC'],
'/CN':['GC'],
'/CO':['GC'],
'/CR':['GC'],
'/CZ':['GC'],
'/DK':['GC'],
'/DO':['GC'],
'/DZ':['GC'],
'/EG':['GC'],
'/MW':['GC'],
'/SD':['GC'],
'/GB':['GC'],
'/GT':['GC'],
'/HK':['GC'],
'/HN':['GC'],
'/HR':['GC'],
'/HU':['GC'],
'/ID':['GC'],
'/IL':['GC'],
'/NP':['GC'],
'/IN':['GC'],
'/JM':['GC'],
'/JO':['GC'],
'/JP':['GC'],
'/KE':['GC'],
'/KR':['GC'],
'/KW':['GC'],
'/KZ':['GC'],
'/LB':['GC'],
'/LK':['GC'],
'/LT':['GC'],
'/LV':['GC'],
'/MA':['GC'],
'/MK':['GC'],
'/MO':['GC'],
'/MU':['GC'],
'/MX':['GC'],
'/MY':['GC'],
'/NI':['GC'],
'/NO':['GC'],
'/NZ':['GC'],
'/OM':['GC'],
'/PA':['GC'],
'/PE':['GC'],
'/PH':['GC'],
'/PK':['GC'],
'/PL':['GC'],
'/PY':['GC'],
'/QA':['GC'],
'/RO':['GC'],
'/TM':['GC'],
'/UZ':['GC'],
'/RU':['GC'],
'/SA':['GC'],
'/SE':['GC'],
'/SG':['GC'],
'/SV':['GC'],
'/TH':['GC'],
'/TN':['GC'],
'/TR':['GC'],
'/TT':['GC'],
'/TW':['GC'],
'/UA':['GC'],
'/UY':['GC'],
'/VN':['GC'],
'/DM':['GC'],
'/ZA':['GC'],
'/PR':['GC'],
'/AF':['GC'],
'/AS':['GC'],
'/AO':['GC'],
'/AG':['GC'],
'/BS':['GC'],
'/BB':['GC'],
'/BW':['GC'],
'/BN':['GC'],
'/BI':['GC'],
'/KH':['GC'],
'/KM':['GC'],
'/CG':['GC'],
'/CK':['GC'],
'/DJ':['GC'],
'/TP':['GC'],
'/ER':['GC'],
'/ET':['GC'],
'/FJ':['GC'],
'/GM':['GC'],
'/GE':['GC'],
'/GD':['GC'],
'/GQ':['GC'],
'/GU':['GC'],
'/GW':['GC'],
'/IS':['GC'],
'/IQ':['GC'],
'/KP':['GC'],
'/LR':['GC'],
'/MV':['GC'],
'/MH':['GC'],
'/MR':['GC'],
'/FM':['GC'],
'/MD':['GC'],
'/MZ':['GC'],
'/NA':['GC'],
'/NG':['GC'],
'/MP':['GC'],
'/PW':['GC'],
'/PS':['GC'],
'/KN':['GC'],
'/LC':['GC'],
'/SB':['GC'],
'/VC':['GC'],
'/TZ':['GC'],
'/TO':['GC'],
'/VE':['GC'],
'/VI':['GC'],
'/YE':['GC'],
'/ZM':['GC'],
'/ZW':['GC'],
'/US':['GC'],
'/EC':['GC'],
'/RS':['GC'],
'/AL':['GC'],
'/AD':['GC'],
'/CY':['GC'],
'/LU':['GC'],
'/MT':['GC'],
'/GF':['GC'],
'/AM':['GC'],
'/AW':['GC'],
'/AZ':['GC'],
'/BY':['GC'],
'/BJ':['GC'],
'/BA':['GC'],
'/BF':['GC'],
'/CM':['GC'],
'/CV':['GC'],
'/CF':['GC'],
'/TD':['GC'],
'/CI':['GC'],
'/FO':['GC'],
'/GA':['GC'],
'/GL':['GC'],
'/LY':['GC'],
'/MG':['GC'],
'/ML':['GC'],
'/MC':['GC'],
'/ME':['GC'],
'/NE':['GC'],
'/RE':['GC'],
'/SM':['GC'],
'/SN':['GC'],
'/SC':['GC'],
'/SR':['GC'],
'/TG':['GC'],
'/VA':['GC'],
'/DE':['GC'],
'/FR':['GC'],
'/NL':['GC'],
'/AT':['GC'],
'/IT':['GC'],
'/ES':['GC'],
'/BE':['GC'],
'/FI':['GC'],
'/IE':['GC'],
'/GR':['GC'],
'/PT':['GC'],
'/SK':['GC'],
'/SI':['GC'],
'/ST':['GC'],
'/EE':['GC']
}

def main():
    
    for country, amounts in optionAmounts.iteritems():
        newpage = wiki.Page(site, basetitle + country)
        if overwrite == True or newpage.exists() == False:
            newcontent = ''
            ocount = 0
            newcontent = newcontent + '<html>\n'
            newcontent = newcontent + '</html>\n'
            newcontent = newcontent + '{{2012FR/Form-section/Processing/Default' + '\n'
            newcontent = newcontent + '| language = {{{language}}}'+ '\n'
            newcontent = newcontent + '| country = {{{country}}}'+ '\n'
            newcontent = newcontent + '| appeal = {{{appeal}}}' + '\n'
            newcontent = newcontent + '| currency = {{2012FR/Switch/Currency/Code|{{{country}}}}}'+ '\n'
            newcontent = newcontent + '| handler = ' + str(paymentProcessing[country][0]) + '\n'
            newcontent = newcontent + '| GC-CC-ffname =  ' + str(paymentButtons[country][0]) + '\n'
            newcontent = newcontent + '}}' + '\n'
            newcontent = newcontent + '{{2012FR/Form-section/Radiobuttons/Default' + '\n'
            newcontent = newcontent + '| country = {{{country}}}'+ '\n'
            newcontent = newcontent + '| language = {{{language}}}'+ '\n'
            newcontent = newcontent + '| currency = {{2012FR/Switch/Currency/Code|{{{country}}}}}'+ '\n'

            for i, x in enumerate(amounts):
                if i == 0 or i == 1 or i == 2 or i == 3 or i == 4 or i == 5 or i == 6:
                    newcontent = newcontent + '| donate-amount-' + str(ocount) + ' = ' + str(x) + '\n'
                    ocount = ocount + 1
            
            newcontent = newcontent + '}}' + '\n' 

            for ii, amounts in enumerate(paymentButtons[country]):
##Credit cards
                if paymentButtons[country][ii][:2] == 'cc':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/Creditcard}}\n'
##Credit Cards

##OnlineBT
                if paymentButtons[country][ii] == 'obt-bp':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/OnlineBT/BPay}}\n'
##OnlineBT

##Real Time
                if paymentButtons[country][ii] == 'rtbt-ideal':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/Realtime/Ideal}}\n'
                if paymentButtons[country][ii] == 'rtbt-eps':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/Realtime/EPS}}\n'
                if paymentButtons[country][ii] == 'rtbt-sofo':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/Realtime/Sofort}}\n'
                if paymentButtons[country][ii] == 'rtbt-en':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/Realtime/Enets}}\n'
                if paymentButtons[country][ii] == 'rtbt-gp':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/Realtime/Giropay}}\n'
##Real Time

##Direct Debit
                if paymentButtons[country][ii] == 'dd':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/Directdebit}}\n'
##Direct Debit

##EWallets
                if paymentButtons[country][ii] == 'ew-pp':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/EWallet/PayPal}}\n'
                if paymentButtons[country][ii] == 'ew-yd':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/EWallet/Yandex}}\n'
                if paymentButtons[country][ii] == 'ew-mb':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/EWallet/Skrill}}\n'
                if paymentButtons[country][ii] == 'ew-wm':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/EWallet/Webmoney}}\n'
                if paymentButtons[country][ii] == 'ew-nd':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/EWallet/Nordea}}\n'
                if paymentButtons[country][ii] == 'ew-ap':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/EWallet/Alipay}}\n'
##EWallets

##Bank Transfer
                if paymentButtons[country][ii] == 'bt':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/Banktransfer}}\n'
##Bank Transfer

##Cash
                if paymentButtons[country][ii] == 'cash-wu':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/Cash/Westernunion}}\n'
                if paymentButtons[country][ii] == 'cash-bl':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/Cash/Boletos}}\n'
##Cash

##Ugly Links
                if paymentButtons[country][ii] == 'ew-pp-usd':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/Link/PayPalUSD}}\n'
                if paymentButtons[country][ii] == 'ew-pp-eur':
                    newcontent = newcontent + '{{2012FR/Form-section/Paymentmethods/Link/PayPalEUR}}\n'
##Ugly Links

            newcontent = newcontent + '<html>\n'
            newcontent = newcontent + '</html>\n'

            newpage.put(newcontent, editsummary)
        else:
            wiki.output("Skipped " + newpage.aslink() + ", already exists")

if __name__ == '__main__':
    try:
        main()
    finally:
        wikipedia.stopme()

"Form-countryspecific-*" Mining code

import wikipedia
import datetime
wiki = wikipedia
site = wiki.getSite('en', 'wikidonate')

basetitle   = 'Template:2012FR/Form-countryspecific-control'
editsummary = 'Updating localized landing page via python script.'
overwrite   = True   # overwrite a page if it already exists? True/False (must be capitalised)
paymentProcessing={
'':['GC'],
'/USD':['GC'],
'/EUR':['GC'],
'/XX':['GC'],
'/AE':['GC'],
'/AN':['GC'],
'/AR':['GC'],
'/PG':['GC'],
'/KI':['GC'],
'/NR':['GC'],
'/VU':['GC'],
'/AU':['GC'],
'/BD':['GC'],
'/BG':['GC'],
'/BH':['GC'],
'/BM':['GC'],
'/BO':['GC'],
'/BR':['GC'],
'/BZ':['GC'],
'/CA':['GC'],
'/LI':['GC'],
'/CH':['GC'],
'/CL':['GC'],
'/CN':['GC'],
'/CO':['GC'],
'/CR':['GC'],
'/CZ':['GC'],
'/DK':['GC'],
'/DO':['GC'],
'/DZ':['GC'],
'/EG':['GC'],
'/MW':['GC'],
'/SD':['GC'],
'/GB':['GC'],
'/GT':['GC'],
'/HK':['GC'],
'/HN':['GC'],
'/HR':['GC'],
'/HU':['GC'],
'/ID':['GC'],
'/IL':['GC'],
'/NP':['GC'],
'/IN':['GC'],
'/JM':['GC'],
'/JO':['GC'],
'/JP':['GC'],
'/KE':['GC'],
'/KR':['GC'],
'/KW':['GC'],
'/KZ':['GC'],
'/LB':['GC'],
'/LK':['GC'],
'/LT':['GC'],
'/LV':['GC'],
'/MA':['GC'],
'/MK':['GC'],
'/MO':['GC'],
'/MU':['GC'],
'/MX':['GC'],
'/MY':['GC'],
'/NI':['GC'],
'/NO':['GC'],
'/NZ':['GC'],
'/OM':['GC'],
'/PA':['GC'],
'/PE':['GC'],
'/PH':['GC'],
'/PK':['GC'],
'/PL':['GC'],
'/PY':['GC'],
'/QA':['GC'],
'/RO':['GC'],
'/TM':['GC'],
'/UZ':['GC'],
'/RU':['GC'],
'/SA':['GC'],
'/SE':['GC'],
'/SG':['GC'],
'/SV':['GC'],
'/TH':['GC'],
'/TN':['GC'],
'/TR':['GC'],
'/TT':['GC'],
'/TW':['GC'],
'/UA':['GC'],
'/UY':['GC'],
'/VN':['GC'],
'/DM':['GC'],
'/ZA':['GC'],
'/PR':['GC'],
'/AF':['GC'],
'/AS':['GC'],
'/AO':['GC'],
'/AG':['GC'],
'/BS':['GC'],
'/BB':['GC'],
'/BW':['GC'],
'/BN':['GC'],
'/BI':['GC'],
'/KH':['GC'],
'/KM':['GC'],
'/CG':['GC'],
'/CK':['GC'],
'/DJ':['GC'],
'/TP':['GC'],
'/ER':['GC'],
'/ET':['GC'],
'/FJ':['GC'],
'/GM':['GC'],
'/GE':['GC'],
'/GD':['GC'],
'/GQ':['GC'],
'/GU':['GC'],
'/GW':['GC'],
'/IS':['GC'],
'/IQ':['GC'],
'/KP':['GC'],
'/LR':['GC'],
'/MV':['GC'],
'/MH':['GC'],
'/MR':['GC'],
'/FM':['GC'],
'/MD':['GC'],
'/MZ':['GC'],
'/NA':['GC'],
'/NG':['GC'],
'/MP':['GC'],
'/PW':['GC'],
'/PS':['GC'],
'/KN':['GC'],
'/LC':['GC'],
'/SB':['GC'],
'/VC':['GC'],
'/TZ':['GC'],
'/TO':['GC'],
'/VE':['GC'],
'/VI':['GC'],
'/YE':['GC'],
'/ZM':['GC'],
'/ZW':['GC'],
'/US':['GC'],
'/EC':['GC'],
'/RS':['GC'],
'/AL':['GC'],
'/AD':['GC'],
'/CY':['GC'],
'/LU':['GC'],
'/MT':['GC'],
'/GF':['GC'],
'/AM':['GC'],
'/AW':['GC'],
'/AZ':['GC'],
'/BY':['GC'],
'/BJ':['GC'],
'/BA':['GC'],
'/BF':['GC'],
'/CM':['GC'],
'/CV':['GC'],
'/CF':['GC'],
'/TD':['GC'],
'/CI':['GC'],
'/FO':['GC'],
'/GA':['GC'],
'/GL':['GC'],
'/LY':['GC'],
'/MG':['GC'],
'/ML':['GC'],
'/MC':['GC'],
'/ME':['GC'],
'/NE':['GC'],
'/RE':['GC'],
'/SM':['GC'],
'/SN':['GC'],
'/SC':['GC'],
'/SR':['GC'],
'/TG':['GC'],
'/VA':['GC'],
'/DE':['GC'],
'/FR':['GC'],
'/NL':['GC'],
'/AT':['GC'],
'/IT':['GC'],
'/ES':['GC'],
'/BE':['GC'],
'/FI':['GC'],
'/IE':['GC'],
'/GR':['GC'],
'/PT':['GC'],
'/SK':['GC'],
'/SI':['GC'],
'/EE':['GC']
}

def main():
    now = datetime.datetime.now()
    fout = open("control-" + now.strftime("%Y-%m-%d@%H:%M:%S") + ".txt", "w")

    values = ''
    for country, amounts in paymentProcessing.iteritems():
        oldpage = wiki.Page(site, basetitle + country)
        oldcontent = oldpage.get()
        lines = oldcontent.split('\n')

        j=0
        values = values + '\'' + country + '\':['
        for i, x in enumerate(lines):
            if lines[i].find('| donate-amount-') != -1:
                values = values + (lines[i].strip('| donate-amount-'))[4:] + ','
                j=j+1
        values = values + '],\n'
        values = values.replace(',]',']')
    values = values[:-2]
    fout.write(values)

if __name__ == '__main__':
    try:
        main()
    finally:
        wikipedia.stopme()

Google currency conversion mining code

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>

using namespace std;

long calculateDigits(double d)
{
	long result = 0;
	long temp = d;
	long place = 1;

	while(temp/place)
	{
		place *= 10;
		result++;
	}
	
	return(result);
}

int main()
{
	string website = "http://www.google.com/finance/";
	string file = "converter?a=1&from=USD&to=";
	string currency;

	ofstream out;
	ifstream currencyFile;

	out.open("Google/ratesGoogle.txt");
	currencyFile.open("currencyCodesAll.txt");

	while(currencyFile >> currency)
	{
		string command = "wget '" + website + file + currency
						+ "' && grep 'currency_converter_result' '"
						+ file + currency + "' > 'resultGoogle.grep'";

		system(command.c_str());
	
		ifstream in("resultGoogle.grep");
	
		string result;

		getline(in,result,'\n');

		in.close();

		system("rm resultGoogle.grep");

		result.erase(0,58);

		bool remove = false;
		for(long i = 0 ; i < result.size() ; i++)
		{
			if(result[i] == ' ')
				remove = true;
			if(remove)
				result[i] = ' ';
		}

		if(result != "")
			out << currency << " " << result << endl;
	}
	system("rm conv*");
	out.close();
	currencyFile.close();

	vector<string> currencyList;
	vector<double> rateList;

	double rate;

	ifstream in("Google/ratesGoogle.txt");

	while(in >> currency && in >> rate)
	{
		rate = ceil(rate*100)/100.0;
		currencyList.push_back(currency);
		rateList.push_back(rate);
	}

	in.close();

	unsigned options[16] = {1,2,3,5,10,15,20,25,30,35,50,75,100,150,200,250};

	vector <vector <double> > currencyOptions;
	currencyOptions.resize(rateList.size());

	for(long i = 0 ; i < currencyOptions.size() ; i++)
	{
		currencyOptions[i].resize(16);
		
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			currencyOptions[i][j] = rateList[i]*options[j];
		}
	}

	// ===================== raw table ==============================
	out.open("Google/currencyOptionsRawGoogle.csv");

	out << "USD, rate,";
	for(long j=0 ; j < 16 ; j++)
	{
		out << options[j] << ", ";
	}
	out << endl;

	for(long i = 0 ; i < currencyOptions.size() ; i++)
	{	
		out << currencyList[i] << ", " << rateList[i] << ", ";
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			out << currencyOptions[i][j] << ", ";
		}
		out << endl;
	}

	out.close();	

	// ================== rounded to nearest dollar ====================

	for(long i = 0 ; i < currencyOptions.size() ; i++)
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
			currencyOptions[i][j] = ceil(currencyOptions[i][j]);

	out.open("Google/currencyOptionsRoundedGoogle.csv");

	out << "USD, rate,";
	for(long j=0 ; j < 16 ; j++)
	{
		out << options[j] << ", ";
	}
	out << endl;

	for(long i = 0 ; i < currencyOptions.size() ; i++)
	{	
		out << currencyList[i] << ", " << rateList[i] << ", ";
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			out << (long)currencyOptions[i][j] << ", ";
		}
		out << endl;
	}

	out.close();

	// =================== zero bottom 1% digits ========================= 
	double temp;
	long digits;

	for(long i = 0 ; i < currencyOptions.size() ; i++)
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			temp = currencyOptions[i][j];
			digits = calculateDigits(temp);

			if(digits < 3)
			{}
			else
			{
				temp /= (long)(pow(10,digits-3));
				temp = ceil(temp);
				temp *= (long)(pow(10,digits-3));
				currencyOptions[i][j] = (long)temp;
			}
		}

	out.open("Google/currencyOptionsZeroBottomGoogle.csv");

	out << "USD, rate,";
	for(long j=0 ; j < 16 ; j++)
	{
		out << options[j] << ", ";
	}
	out << endl;

	for(long i = 0 ; i < currencyOptions.size() ; i++)
	{	
		out << currencyList[i] << ", " << rateList[i] << ", ";
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			out << (long)currencyOptions[i][j] << ", ";
		}
		out << endl;
	}

	out.close();

	// =================== zero bottom 1% digits 5-ify ========================= 

	long ones;

	for(long i = 0 ; i < currencyOptions.size() ; i++)
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			temp = currencyOptions[i][j];
			digits = calculateDigits(temp);

			if(digits == 1)
			{
				//temp /= 5;
				//temp = round(temp);
				//temp *= 5;
				//currencyOptions[i][j] = temp;	
			}
			else
			{
				if(digits > 3)
					temp /= (long)(pow(10,digits-3));

				ones = (long)(temp)%10;
				temp = temp - ones;
				if(ones > 0 and ones <= 5)
				{
					temp += 5;
				}
				else if(ones > 6 and ones <= 9)
				{
					temp += 10;
				}
				
				if(digits > 3)
					temp *= (long)(pow(10,digits-3));

				currencyOptions[i][j] = (long)temp;
			}
		}

	out.open("Google/currencyOptions5ifyGoogle.csv");

	out << "USD, rate,";
	for(long j=0 ; j < 16 ; j++)
	{
		out << options[j] << ", ";
	}
	out << endl;

	for(long i = 0 ; i < currencyOptions.size() ; i++)
	{	
		out << currencyList[i] << ", " << rateList[i] << ", ";
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			out << (long)currencyOptions[i][j] << ", ";
		}
		out << endl;
	}

	out.close();

	return 0;
}

Bloomberg currency conversion mining code

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>

using namespace std;

long calculateDigits(double d)
{
	long result = 0;
	long temp = d;
	long place = 1;

	while(temp/place)
	{
		place *= 10;
		result++;
	}
	
	return(result);
}

int main()
{
		string website =  "http://www.bloomberg.com/personal-finance/calculators/currency-converter/";
		string currency;

		ofstream out;

		out.open("Bloomberg/ratesBloomberg.txt");

		string command = "wget '" + website 
					   + "' && grep \":CUR\'\" 'index.html' > 'resultBloomberg.grep'";
		system(command.c_str());

	ifstream in("resultBloomberg.grep");
	string result;

	while(getline(in,result,'\n'))
	{

		string tempString;

		result.erase(0,23);
		tempString = result.substr(0,3);
		result.erase(0,12);
		result.erase(result.end()-1,result.end());

		if(result != "")
			out << tempString << " " << result << endl;
	}

	in.close();
	system("rm resultBloomberg.grep");
	system("rm inde*");
	out.close();

	vector<string> currencyList;
	vector<double> rateList;

	double rate;

	in.open("Bloomberg/ratesBloomberg.txt");

	while(in >> currency && in >> rate)
	{
		rate = ceil(rate*100)/100.0;
		currencyList.push_back(currency);
		rateList.push_back(rate);
	}

	in.close();

	unsigned options[17] = {1,2,3,5,10,15,20,25,30,35,50,75,100,150,200,250,29500000};

	vector <vector <double> > currencyOptions;
	currencyOptions.resize(rateList.size());

	for(long i = 0 ; i < currencyOptions.size() ; i++)
	{
		currencyOptions[i].resize(17);
		
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			currencyOptions[i][j] = rateList[i]*options[j];
		}
	}

	// ===================== raw table ==============================
	out.open("Bloomberg/currencyOptionsRawBloomberg.csv");

	out << "USD, rate,";
	for(long j=0 ; j < 17 ; j++)
	{
		out << options[j] << ", ";
	}
	out << endl;

	for(long i = 0 ; i < currencyOptions.size() ; i++)
	{	
		out << currencyList[i] << ", " << rateList[i] << ", ";
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			out << currencyOptions[i][j] << ", ";
		}
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			out << (long)currencyOptions[i][j] << " ";
		}
		out << endl;
	}

	out.close();	

	// ================== rounded to nearest dollar ====================

	for(long i = 0 ; i < currencyOptions.size() ; i++)
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
			currencyOptions[i][j] = ceil(currencyOptions[i][j]);

	out.open("Bloomberg/currencyOptionsRoundedBloomberg.csv");

	out << "USD, rate,";
	for(long j=0 ; j < 17 ; j++)
	{
		out << options[j] << ", ";
	}
	out << endl;

	for(long i = 0 ; i < currencyOptions.size() ; i++)
	{	
		out << currencyList[i] << ", " << rateList[i] << ", ";
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			out << (long)currencyOptions[i][j] << ", ";
		}
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			out << (long)currencyOptions[i][j] << " ";
		}
		out << endl;
	}

	out.close();

	// =================== zero bottom 1% digits ========================= 
	double temp;
	long digits;

	for(long i = 0 ; i < currencyOptions.size() ; i++)
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			temp = currencyOptions[i][j];
			digits = calculateDigits(temp);

			if(digits < 4)
			{}
			else
			{
				temp /= (long)(pow(10,digits-3));
				temp = ceil(temp);
				temp *= (long)(pow(10,digits-3));
				currencyOptions[i][j] = (long)temp;
			}
		}

	out.open("Bloomberg/currencyOptionsZeroBottomBloomberg.csv");

	out << "USD, rate,";
	for(long j=0 ; j < 17 ; j++)
	{
		out << options[j] << ", ";
	}
	out << endl;

	for(long i = 0 ; i < currencyOptions.size() ; i++)
	{	
		out << currencyList[i] << ", " << rateList[i] << ", ";
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			out << (long)currencyOptions[i][j] << ", ";
		}
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			out << (long)currencyOptions[i][j] << " ";
		}
		out << endl;
	}

	out.close();

	// =================== zero bottom 1% digits 5-ify ========================= 
	long ones;

	for(long i = 0 ; i < currencyOptions.size() ; i++)
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			temp = currencyOptions[i][j];
			digits = calculateDigits(temp);

			if(digits == 1)
			{
				//temp /= 5;
				//temp = round(temp);
				//temp *= 5;
				//currencyOptions[i][j] = temp;	
			}
			else
			{
				if(digits > 3)
					temp /= (long)(pow(10,digits-3));

				ones = (long)(temp)%10;
				temp = temp - ones;
				if(ones > 0 and ones <= 5)
				{
					temp += 5;
				}
				else if(ones >= 6 and ones <= 9)
				{
					temp += 10;
				}
				
				if(digits > 3)
					temp *= (long)(pow(10,digits-3));

				currencyOptions[i][j] = (long)temp;
			}
		}

	out.open("Bloomberg/currencyOptions5ifyBloomberg.csv");

	out << "USD, rate,";
	for(long j=0 ; j < 17 ; j++)
	{
		out << options[j] << ", ";
	}
	out << endl;

	for(long i = 0 ; i < currencyOptions.size() ; i++)
	{	
		out << currencyList[i] << ", " << rateList[i] << ", ";
		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			out << (long)currencyOptions[i][j] << ", ";
		}

		for(long j=0 ; j < currencyOptions[i].size() ; j++)
		{
			out << (long)currencyOptions[i][j] << " ";
		}
		out << ", ";

		out << "\"" << (long)currencyOptions[i][3] << " "	
			<< (long)currencyOptions[i][4] << " " 
			<< (long)currencyOptions[i][6] << " " 
			<< (long)currencyOptions[i][9] << " " 
			<< (long)currencyOptions[i][10] << " " 
			<< (long)currencyOptions[i][12] << " " 
			<< (long)currencyOptions[i][15] << "\"" << endl;
	}

	out.close();

	return 0;
}