-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
55 lines (47 loc) · 1.27 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from bs4 import BeautifulSoup
import urllib2
url="http://fiikus.net/?pokedex"
webpage = urllib2.urlopen(url)
soup = BeautifulSoup(webpage)
list=[]
for anchor in soup.find_all('a'):
try:
k=str(anchor.string)
if k[0]=="#":
L=str(anchor.string).split(" ")[1:]
list.append((" ".join(L)).lower())
except:pass
print """#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
"""
a=r'printf("\n");'
for I in list:
f=open(I,"r").read()
i=I.replace('"','').replace('(','').replace(')','').replace(' ','').replace("'",'').replace(".",'')
print "void",i,"(){"
for line in f.split("\n"):
if line:
print 'printf("',line.replace("\\","\\\\").replace('"',r'\"').replace("(",r"\(").replace(")",r"\(").replace("'",r"\'"),'");',a
print "}"
print """void print(string s){"""
for I in list:
i=I.replace('"','').replace('(','').replace(".",'').replace(')','').replace(' ','').replace("'",'')
print "if (s=="+'"'+i+'"){',i+"();","""return;}"""
print """ cout<<"No suck pokemon"<<endl;"""
print "}"
print """int main(int argc, char* argv[]){
if(argc<1)
{
printf("No pokemon entered");
}
string s=argv[1];
for(int i=0;i<s.length();i++)
{
s[i]=tolower(s[i]);
}
print(s);
"""
print """return (0);
}"""