利用者:素手/韓国野球選手変換ローカルスクリプト
表示
< 利用者:素手
仕様書
[編集]済
[編集]- テンプレを日本語に変換
- デフォルトソートを平仮名に
- 韓国版の漢字表記をGet
- 出身市町村を日本語変換
- 投手成績データベース
- 勝率計算
まだ
[編集]- 本人表記のラテン語と実際の転写を分別
- 打撃成績データベース
- カタカナでリダイレクトを作成。もし既にリダイレクトが存在すればその旨を伝え、手作業
- \n hangulname ( or ( 、漢字 , or . 西暦が含まれる
- 小数点第2
カテゴリ
[編集]全て済
- 韓国の野球選手
- (チーム)~の選手
- ~(地名)出身の人物
- 年生まれ
- 存命人物
#coding:utf-8 #!/usr/bin/python -S import sys from urllib import urlopen import linecache import wikipedia import sys import codecs import re import linecache import sqlite3 name = u"ロマン・コロン" #日本語用漢字名を記入。 yomi = u"ロマン・コロン" #読み nyomi = u"" #現地読み latin = "Román Benedicto Colón" #本人表記のラテン名 team = u"" wikiurl = u"http://ko.wikipedia.org/wiki/로만_콜론" #Wikipediaの記事URL hangeul = wikiurl.replace("http://ko.wikipedia.org/wiki/","") resulturl = "http://www.baseball-reference.com/players/c/colonro01.shtml" #statizのURL #WikipediaのURLから曖昧さ回避を除去 if hangeul.find(hangeul+"_") != -1: hangeulc = hangeul[0:hangeul.index(hangeul+"_")] else: hangeulc = hangeul yahoo = open("yahoo.txt","w") #yahoo = codecs.lookup('utf_8')[-1](yahoo) CURRENT_YEAR = u"2010" #(定数)現在の西暦 num = 0 ryear = list() rteam = list() rgame = list() rstart = list() rera = list() rwin = list() rlose = list() rsave = list() rhold = list() rwp = list() rbatter = list() rcg = list() rsho = list() rinning = list() rhit = list() rhr = list() r4ball = list() r4walk = list() rdead = list() rstrikeout = list() rlosspoint = list() rearnedrun = list() rwhip = list() rbalk = list() rwildpitch = list() rno4d = list() #ja:wikipediaのリンクを取得。なければNone def getjalink(pagename): pagename = pagename.replace("[[","").replace("]]","") wikipedia.output(u"Loading %s..." % pagename) for f2 in wikipedia.Page(wikipedia.getSite(),pagename).get(force = False, get_redirect=False, throttle = True, sysop = False, change_edit_time = True).encode("utf8").split("\n"): if f2.find(u"[[ja:") != -1: return f2.replace("[[ja:","[[") break return "None" def templateCut(tc,tcc): #テンプレートの余計な文字をCut return tc.replace(tcc,"").replace("=","").strip() def defaultsort(kana):#DEFAULTSORTでカナをひらがなに return kana.replace("ア","あ").replace("イ","い").replace("ウ","う").replace("エ","え").replace("オ","お").replace("カ","か").replace("キ","き").replace("ク","く").replace("ケ","け").replace("コ","こ").replace("サ","さ").replace("シ","し").replace("ス","す").replace("セ","せ").replace("ソ","そ").replace("タ","た").replace("チ","ち").replace("ツ","つ").replace("テ","て").replace("ト","と").replace("ナ","な").replace("ニ","に").replace("ヌ","ぬ").replace("ネ","ね").replace("ノ","の").replace("ハ","は").replace("ヒ","ひ").replace("フ","ふ").replace("ヘ","へ").replace("ホ","ほ").replace("マ","ま").replace("ミ","み").replace("ム","む").replace("メ","め").replace("モ","も").replace("ヤ","や").replace("ユ","ゆ").replace("ヨ","よ").replace("ラ","ら").replace("リ","り").replace("ル","る").replace("レ","れ").replace("ロ","ろ").replace("ワ","わ").replace("ヲ","を").replace("ン","ん").replace("ガ","か").replace("ギ","き").replace("グ","く").replace("ゲ","け").replace("ゴ","こ").replace("ザ","さ").replace("ジ","し").replace("ズ","す").replace("ゼ","せ").replace("ゾ","そ").replace("ダ","た").replace("ヂ","ち").replace("ヅ","つ").replace("デ","て").replace("ド","と").replace("バ","は").replace("ビ","ひ").replace("ブ","ふ").replace("ベ","へ").replace("ボ","ほ").replace("パ","は").replace("ピ","ひ").replace("プ","ふ").replace("ペ","へ").replace("ポ","ほ").replace("ァ","あ").replace("ィ","い").replace("ゥ","う").replace("ェ","え").replace("ォ","お").replace("ャ","や").replace("ュ","ゆ").replace("ョ","よ").replace("ヴ","う").replace("・"," ") def resultcut(r): #koreabaseball成績表の余計な文字をCut return r.replace("<td width=","").replace(" align=\"center\">","").replace("\"50\"","").replace("\"45\"","").replace("\"40\"","").replace("\t","").replace("</td>","").replace("\r","").replace("\n","") def resultteam(t): #成績用チーム名の変換 if t == "KIA": return u"起亜タイガース|起亜" elif t == u"한화": return "ハンファ・イーグルス|ハンファ" elif t == u"해태": return u"起亜タイガース|ヘテ" elif t == u"SK": return u"SKワイバーンズ|SK" elif t == u"해태/KIA": return u"起亜タイガース|起亜" elif t == u"OB": return u"斗山ベアーズ|OB" elif t == u"쌍방울": return u"サンバンウル・レイダース|サンバンウル" elif t == u"FLA": return u"フロリダ・マーリンズ|FLA" elif t == u"MIL": return u"ミルウォーキー・ブルワーズ|MIL" elif t == u"MIL": return u"デトロイト・タイガース|DET" elif t == u"ATL": return u"アトランタ・ブレーブス|ATL" elif t == u"KCR": return u"カンザスシティ・ロイヤルズ|KCR" def totalresult(r): #成績の合計 t = 0 for i in r: t += int(i) return t def rcut(r): return r.replace("</font","") def getresulturl(resulturl): g = "" for i in urlopen(resulturl).readlines(): if i.find("<tr class=colhead_stz0><td>") != -1: g = i.replace("</td>","").replace("<font color=#4B4B4B>","").replace("</font>","").replace("<td style=\'text-align:right;\' class=statdata","") break return g.split(">") def bbcut(r): return r[r.index("\" >")+3:r.index("</td>")].replace("<strong>","").replace("</strong>","") def bbteamcut(r): return r[r.index("\">")+2:r.index("</A>")] def getwp(w,l): t = 0,0 try: t = float(w) / (float(w) + float(l)) t = str(round(t,3)) if t.find("0.") != -1: t = t[1:] else: t = "1.000" if len(t) == 2: t = t+"00" elif len(t) == 3: t = t+"0" except ZeroDivisionError: t = "---" return t def getbbresult(): g = urlopen(resulturl).readlines() a = 0 for i in g: if i.find("<tr onmouseover=\"hl(this);\" onmouseout=\"uhl(this);\" class=\"full\" onclick=\"sum_span(this);\" id=\"pitching_simple.") != -1: if bbcut(g[a+1]).find(CURRENT_YEAR) != -1: break ryear.append(bbcut(g[a+1])) rteam.append(resultteam(bbteamcut(g[a+3]))) rwin.append(bbcut(g[a+5])) rlose.append(bbcut(g[a+6])) rera.append(bbcut(g[a+8])) rgame.append(bbcut(g[a+9])) rstart.append(bbcut(g[a+10])) rcg.append(bbcut(g[a+12])) rsho.append(bbcut(g[a+13])) rsave.append(bbcut(g[a+14])) rinning.append(bbcut(g[a+15])) rhit.append(bbcut(g[a+16])) rhr.append(bbcut(g[a+19])) rlosspoint.append(bbcut(g[a+17])) rearnedrun.append(bbcut(g[a+18])) r4ball.append(bbcut(g[a+20])) r4walk.append(bbcut(g[a+21])) rstrikeout.append(bbcut(g[a+22])) rdead.append(bbcut(g[a+23])) rbalk.append(bbcut(g[a+24])) rwildpitch.append(bbcut(g[a+25])) rbatter.append(bbcut(g[a+26])) #無四球とホールド print u"無四球とホールドをチェックしています",bbcut(g[a+1]) logurl = resulturl.replace("http://www.baseball-reference.com/players/","").replace(".shtml","") logurl = logurl[2:] logurl = "http://www.baseball-reference.com/players/gl.cgi?n1="+logurl+"&t=p&year="+bbcut(g[a+1]) lg = urlopen(logurl).readlines() ln = 0 no4d = 0 hold = 0 for l in lg: if l.find("pitching_gamelogs") != -1: #無四球 if lg[ln+9].find(">CG<") != -1 or lg[ln+9].find("(>SHO<") != -1: if int(bbcut(lg[ln+16])) == 0 and int(bbcut(lg[ln+19])) == 0: print u"1個あり" no4d += 1 #ホールド if lg[ln+10].find("H(") != -1: hold += 1 ln += 1 rno4d.append(str(no4d)) rhold.append(str(hold)) a += 1 #勝率 a = 0 for i in rwin: rwp.append(getwp(rwin[a],rlose[a])) a += 1 #WHIP a = 0 for i in ryear: #rwhip.append(round((float(rhit[a])+float(r4ball[a])) / float(rinning[a]), 2)) wera = rinning[a].split(".") wera[1] = int(wera[1]) * 3 wera = str(wera[0]) +"."+str(wera[1]) wp = str(round((float(rhit[a])+float(r4ball[a])) / float(wera),2)) rwhip.append(wp) a += 1 print ryear,"ryear" print rteam,"rteam" print rgame,"rgame" print rstart,"rstart" print rcg,"rcg" print rsho,"rsho" print rno4d,"rno4d" print rwin,"rwin" print rlose,"rlose" print rwp,"rwp" print rsave,"rsave" print rinning,"rinning" print rhit,"rhit" print rhr,"rhr" print r4ball,"r4ball" print rstrikeout,"rstrikeout" print rwhip,"rwhip" print rera,"rera" print rhold,"rhold" print rlosspoint,"rlosspoint" print rearnedrun,"rearnedrun" print rbatter,"rbatter" print r4walk,"r4walk" print rdead,"rdead" print rbalk,"rbalk" print rwildpitch,"rwildpitch" def statizresult1(): gettext = getresulturl(resulturl) a = 0 for i in gettext: if i.find("<td align=center class=colhead_stz") != -1: if gettext[a+1].find(CURRENT_YEAR) != -1: break if gettext[a+1].find("<td colspan=2") != -1: break ryear.append(gettext[a+1].replace("<td align=center","")) rteam.append(resultteam(gettext[a+2].replace("<td align=center",""))) rgame.append(rcut(gettext[a+4])) rstart.append(rcut(gettext[a+5])) rwin.append(rcut(gettext[a+6])) rlose.append(rcut(gettext[a+7])) rsave.append(rcut(gettext[a+8])) rinning.append(rcut(gettext[a+9])) rhit.append(rcut(gettext[a+10])) rhr.append(rcut(gettext[a+11])) r4ball.append(rcut(gettext[a+12])) rstrikeout.append(rcut(gettext[a+13])) rwhip.append(rcut(gettext[a+16])) rera.append(rcut(gettext[a+17])) a += 1 #勝率計算 a = 0 t = 0,0 for i in rwin: try: t = float(rwin[a]) / (float(rwin[a]) + float(rlose[a])) t = str(round(t,3)) if t.find("0.") != -1: t = t[1:] else: t = "1.000" if len(t) == 2: t = t+"00" elif len(t) == 3: t = t+"0" except ZeroDivisionError: t = "---" rwp.append(t) a += 1 print ryear,"ryear" print rteam,"rteam" print rgame,"rgame" print rstart,"rstart" print rwin,"rwin" print rlose,"rlose" print rwp,"rwp" print rsave,"rsave" print rinning,"rinning" print rhit,"rhit" print rhr,"rhr" print r4ball,"r4ball" print rstrikeout,"rstrikeout" print rwhip,"rwhip" print rera,"rera" def statizresult2(): resulturl2 = resulturl+"&re=1&se=0&da=2" gettext = getresulturl(resulturl2) a = 0 for i in gettext: if i.find("<td align=center class=colhead_stz") != -1: if gettext[a+1].find(CURRENT_YEAR) != -1: break if gettext[a+1].find("<td colspan=2") != -1: break rcg.append(rcut(gettext[a+6])) rsho.append(rcut(gettext[a+7])) rhold.append(rcut(gettext[a+10])) rlosspoint.append(rcut(gettext[a+13])) rearnedrun.append(rcut(gettext[a+14])) rbatter.append(rcut(gettext[a+15])) r4walk.append(rcut(gettext[a+23])) rdead.append(rcut(gettext[a+24])) a += 1 print rcg,"rcg" print rsho,"rsho" print rhold,"rhold" print rlosspoint,"rlosspoint" print rearnedrun,"rearnedrun" print rbatter,"rbatter" print r4walk,"r4walk" print rdead,"rdead" def statizresult3(): resulturl3 = resulturl+"&re=1&se=0&da=11" gettext = getresulturl(resulturl3) a = 0 for i in gettext: if i.find("<td align=center class=colhead_stz") != -1: if gettext[a+1].find(CURRENT_YEAR) != -1: break if gettext[a+1].find("<td colspan=2") != -1: break rbalk.append(rcut(gettext[a+22])) rwildpitch.append(rcut(gettext[a+24]).replace("</tr","")) a += 1 print rbalk,"rbalk" print rwildpitch,"rwildpitch" #調整して書き込み def statizresults(): #イニング数の分数表記を小数表記に copyrinning = rinning[:] rinningdot = 0 tinning = 0 num = 0 for i in rinning: if i.find(".") != -1: i = i.split(".") i[1] = i[1].replace(".0","").replace(".1","").replace(".2","") copyrinning[num] = str(i[0])+"."+str(i[1]) rinningdot += int(i[1]) rinning[num] = i[0] num += 1 else: tinning += int(i) copyrinning[num] = copyrinning[num] + ".0" num += 1 #通算成績を取得 tgame = totalresult(rgame) tstart = totalresult(rstart) twin = totalresult(rwin) tlose = totalresult(rlose) tsave = totalresult(rsave) thold = totalresult(rhold) tbatter = totalresult(rbatter) tcg = totalresult(rcg) tsho = totalresult(rsho) tno4d = totalresult(rno4d) tinning = totalresult(rinning) thit = totalresult(rhit) thr = totalresult(rhr) t4ball = totalresult(r4ball) tstrikeout = totalresult(rstrikeout) tlosspoint = totalresult(rlosspoint) tearnedrun = totalresult(rearnedrun) t4walk = totalresult(r4walk) tdead = totalresult(rdead) twildpitch = totalresult(rwildpitch) tbalk = totalresult(rbalk) #イニング数の合計表記を小数表記に tinning = int(tinning)+rinningdot/3 tinning = str(tinning)+"."+str(rinningdot % 3) erat = 0 if tinning.find(".") != -1: erat = tinning.split(".") erat[1] = int(erat[1]) * 3 erat = str(erat[0])+"."+str(erat[1]) #通算防御率の計算 tera = round(float(tearnedrun)/float(erat)*9, 2) tcheck = str(tera).split(".") if len(tcheck[1]) == 1: tcheck[1] = tcheck[1] + str(0) tera = str(tcheck[0])+"."+str(tcheck[1]) if tinning.find(".") != -1: wera = tinning.split(".") wera[1] = int(wera[1] * 3) wera = str(wera[0]) +"."+str(wera[1]) twhip = round((float(thit)+float(t4ball)) / float(wera), 2) #通算勝率計算 a = 0 t = 0,0 try: for i in rwin: t = float(twin) / (float(twin) + float(tlose)) t = str(round(t,3)) if t.find("0.") != -1: t = t[1:] else: t = "1.000" if len(t) == 3: t = t+"0" twp = t a += 1 except ZeroDivisionError: twp = "---" #投手成績を書き込み tn = 0 for i in rteam: if rteam[0] == i: tn += 1 #後で消す yahoo.write(u"==詳細成績==\n===年度別投手成績===\n") yahoo.write(u"{| {{投手成績|リーグ=韓国野球委員会}}\n|-\n") rnum = 0 num = tn rowcheck = 0 for i in ryear: if tn < 1: rowcheck = 0 for j in rteam[rnum:]: if rteam[rnum] == j: tn += 1 yahoo.write("|style=\"text-align:center\"|{{by2|"+ryear[rnum]+"}}\n") if rowcheck == 0: yahoo.write("|rowspan=\""+str(tn)+"\" style=\"text-align:center;\"|[["+rteam[rnum]+"]]\n") rowcheck = 1 """elif tn == 1: yahoo.write("style=\"text-align:center\"|"+rteam[rnum]+"\n")""" #年度別の書き込み yahoo.write("||"+rgame[rnum]) yahoo.write("||"+rstart[rnum]) yahoo.write("||"+rcg[rnum]) yahoo.write("||"+rsho[rnum]) yahoo.write("||"+rno4d[rnum]) yahoo.write("||"+rwin[rnum]) yahoo.write("||"+rlose[rnum]) yahoo.write("||"+rsave[rnum]) if int(ryear[rnum]) > 1999: yahoo.write("||"+rhold[rnum]) else: yahoo.write("||---") yahoo.write("||"+rwp[rnum]) yahoo.write("||"+rbatter[rnum]) yahoo.write("||"+copyrinning[rnum]) yahoo.write("||"+rhit[rnum]) yahoo.write("||"+rhr[rnum]) yahoo.write("||"+r4ball[rnum]) yahoo.write("||"+r4walk[rnum]) yahoo.write("||"+rdead[rnum]) yahoo.write("||"+rstrikeout[rnum]) yahoo.write("||"+rwildpitch[rnum]) yahoo.write("||"+rbalk[rnum]) yahoo.write("||"+rlosspoint[rnum]) yahoo.write("||"+rearnedrun[rnum]) yahoo.write("||"+rera[rnum]) yahoo.write("||"+rwhip[rnum]) yahoo.write("\n|-\n") rnum += 1 tn -= 1 #合計成績を書き込み yahoo.write("!colspan=\""+str(2)+"\"|通算:"+str(len(ryear))+"年\n") yahoo.write("||"+str(tgame)+"||"+str(tstart)+"||"+str(tcg)+"||"+str(tsho)+"||") yahoo.write(str(tno4d)) yahoo.write("||"+str(twin)+"||"+str(tlose)+"||"+str(tsave)+"||"+str(thold)+"||"+str(twp)+"||"+str(tbatter)+" ||"+str(tinning)+"||"+str(thit)+"||"+str(thr)+"||"+str(t4ball)+"||"+str(t4walk)+"||"+str(tdead)+"||"+str(tstrikeout)+"||"+str(twildpitch)+"||"+str(tbalk)+"||"+str(tlosspoint)+"||"+str(tearnedrun)+"||"+str(tera)+"||"+str(twhip)+"\n|}") yahoo.write("\n\n==外部リンク==\n*["+resulturl+" "+name.replace(" ","")+" - statiz.co.kr]\n") def main(): site = wikipedia.getSite() pagename = hangeul page = wikipedia.Page(site,pagename) wikipedia.output(u"Loading %s..." % pagename) text = page.get(force = False, get_redirect=False, throttle = True, sysop = False, change_edit_time = True) fortext = text.encode("utf8").split("\n") #韓国語テンプレを日本語に変換 c = 0 career = list() for a in fortext: tcc = u"|선수명" tcc = tcc.encode("utf8") if a.find(tcc) != -1: hangeulname = templateCut(a,tcc) tcc = u"|등번호" tcc = tcc.encode("utf8") if a.find(tcc) != -1: number = templateCut(a,tcc) #国籍 tcc = u"|국적" if a.find(tcc) != -1: national = templateCut(a,tcc) #出身地 tcc = u"|출신지" tcc = tcc.encode("utf8") try: if a.find(tcc) != -1: from1 = templateCut(a,tcc) from1 = templateCut(a,tcc).replace(" ","").replace("=","") if from1.find("]][[") != -1: from1 = from1.replace("[[","").split("]]") del from1[len(from1) - 1] print from1 getfrom = ["1"] for f1 in from1: getfrom.append(getjalink(f1)) del getfrom[0] print getfrom from1 = "" for f3 in getfrom: from1 += f3 elif from1.find("[[") != -1: print from1 from1 = from1.replace("]]","").replace("[[","") from1 = getjalink(from1) else: from1 = "none" except: from1 = "None" tcc = u"|생년월일" if a.find(tcc) != -1: birth = templateCut(a,tcc) if birth.find("출생일과 나이") != -1: birth = birth.replace(u"출생일과 나이",u"生年月日と年齢") tcc = u"|신장" tcc = tcc.encode("utf8") if a.find(tcc) != -1: height = templateCut(a,tcc) tcc = u"|체중" tcc = tcc.encode("utf8") if a.find(tcc) != -1: weight = templateCut(a,tcc) else: weight = u"体重表記無し" tcc = u"|수비 위치" tcc = tcc.encode("utf8") if a.find(tcc) != -1: position = templateCut(a,tcc) position = position.replace("투수","投手").replace("포수","捕手").replace("2루수","二塁手").replace("3루수","三塁手").replace("유격수","遊撃手").replace("내야수","内野手").replace("외야수","外野手").replace("좌익수","左翼手").replace("중견수","中堅手").replace("우익수","右翼手") tcc = u"|투구" tcc = tcc.encode("utf8") if a.find(tcc) != -1: kikinage = templateCut(a,tcc) kikinage = kikinage.replace("좌","左").replace("우","右") tcc = u"|타석" tcc = tcc.encode("utf8") if a.find(tcc) != -1: kikiuchi = templateCut(a,tcc) kikiuchi = kikiuchi.replace("좌","左").replace("우","右").replace("양","両") tcc = u"|프로 입단 연도" tcc = tcc.encode("utf8") if a.find(tcc) != -1: draft = templateCut(a,tcc) draft = draft.replace("년","年") tcc = u"|연봉" tcc = tcc.encode("utf8") if a.find(tcc) != -1: salary = templateCut(a,tcc) salary = salary.replace("억","億").replace("원","ウォン").replace("달러","ドル").replace("천","千").replace("만","万").replace("년","年") #経歴取得 tcc = u"|경력" thetext = "" if a.find(tcc) != -1: for i in range(30): if fortext[c+i+1].find("}}") != 0: thetext = fortext[c+i+1] thetext = getjalink(thetext[thetext.index("[["):thetext.index("]]")]) career.append(thetext+""+fortext[c+i+1][fortext[c+i+1].index("]]")+2:].replace("현재","").replace("(","(").replace(")",")").replace("~","-")) if career[i].find(" -") == -1: career[i] = career[i].replace("-", " -") if career[i].find("- ") == -1: career[i] = career[i].replace("-", "- ") else: break if len(career) != 0: team = career[len(career)-1].replace("[[","").replace("]]","") team = team[:team.index("(")].replace(" ","") if a.find(u"'''"+hangeulc+"'''") != -1: hkanji = a.replace("'''","").replace(hangeulc,"")[1:4] break else: hkanji = u"漢字表記を取得して下さい" c += 1 ymd = birth.replace("{{生年月日と年齢|","").replace("}}","") ymd = ymd.split("|") yahoo.write("{{Infobox baseball player\n") yahoo.write("|選手名 = "+name+"\n") yahoo.write("|所属球団 = "+team+"\n") yahoo.write("|背番号 = "+number+"\n") yahoo.write("|国籍 = "+national+"\n") yahoo.write("|出身地 = {{Flagicon|"+national[2:5]+"}} "+from1+"\n") yahoo.write("|生年月日 = "+birth+"\n") yahoo.write("|没年月日 = \n") yahoo.write("|身長 = "+height+"\n") yahoo.write("|体重 = "+weight+"\n") yahoo.write("|利き腕 = "+kikinage+"\n") yahoo.write("|打席 = "+kikiuchi+"\n") yahoo.write("|守備位置 = "+position+"\n") yahoo.write("|プロ入り年度 = "+draft+"\n") yahoo.write("|年俸 = "+salary+"\n") yahoo.write("|経歴 = \n") for i in career: yahoo.write("*"+i+"\n") yahoo.write("}}\n") if national.find("KOR") != -1: yahoo.write("{{韓国の人物\n|title= "+yomi+"\n|latin= "+latin+"\n|hangeul= "+hangeulc+"\n|hanja= "+hkanji+"\n|katakana= "+yomi+"<br>"+nyomi+"\n}}\n") yahoo.write("'''"+name+"'''("+yomi+"、[["+ymd[0]+"年]][["+ymd[1]+"月"+ymd[2]+"日]] - )は[["+team+"]]に所属する[[大韓民国|韓国]]の[[プロ野球選手]]("+position+")。\n\n") yahoo.write("==概要==\n\n") #statizresults() yahoo.write("{{Baseball-biography-stub}}\n{{DEFAULTSORT:"+defaultsort(yomi)+"}}\n{{"+team+"}}\n\n") yahoo.write("[[Category:韓国の野球選手]]\n") acheck = 0 bcheck = 0 check = 0 dcheck = 0 echeck = 0 fcheck = 0 gcheck = 0 hcheck = 0 icheck = 0 jcheck = 0 for i in career: if i.find("起亜タイガース") != -1 or i.find("ヘテ・タイガース")!= -1: if acheck == 0: yahoo.write("[[Category:起亜タイガース及びヘテ・タイガースの選手]]\n") acheck = 1 if i.find("SKワイバーンズ") != -1: if bcheck == 0: yahoo.write("[[Category:SKワイバーンズの選手]]\n") bcheck = 1 if i.find("LGツインズ") != -1 or i.find("MBC青龍") != -1: if ccheck == 0: yahoo.write("[[Category:LGツインズ及びMBC青龍の選手]]\n") ccheck = 1 if i.find("三星ライオンズ") != -1: if dcheck == 0: yahoo.write("[[Category:三星ライオンズの選手]]\n") dcheck = 1 if i.find("サンバンウル・レイダース") != -1: if echeck == 0: yahoo.write("[[Category:サンバンウル・レイダースの選手]]\n") echeck = 1 if i.find("斗山ベアーズ及びOBベアーズ") != -1: if fcheck == 0: yahoo.write("[[Category:斗山ベアーズ及びOBベアーズの選手]]\n") fcheck = 1 if i.find("ネクセン・ヒーローズ及びその前身球団") != -1: if gcheck == 0: yahoo.write("[[Category:ネクセン・ヒーローズ及びその前身球団の選手]]\n") gcheck = 1 if i.find("ハンファ・イーグルス及びピングレ・イーグルス") != -1: if hcheck == 0: yahoo.write("[[Category:ハンファ・イーグルス及びピングレ・イーグルスの選手]]\n") hcheck = 1 if i.find("現代ユニコーンズ及びその前身球団") != -1: if icheck == 0: yahoo.write("[[Category:現代ユニコーンズ及びその前身球団の選手]]\n") icheck = 1 if i.find("ロッテジャイアンツ") != -1: if jcheck == 0: yahoo.write("[[Category:ロッテジャイアンツの選手]]\n") jcheck = 1 if from1.find("ソウル特別市") != -1: yahoo.write("[[Category:ソウル特別市出身の人物]]\n") elif from1.find("仁川広域市") != -1: yahoo.write("[[Category:仁川広域市出身の人物]]\n") elif from1.find("光州広域市") != -1: yahoo.write("[[Category:光州広域市出身の人物]]\n") elif from1.find("蔚山広域市") != -1: yahoo.write("[[Category:蔚山広域市出身の人物]]\n") elif from1.find("江原道") != -1: yahoo.write("[[Category:江原道出身の人物]]\n") elif from1.find("京畿道") != -1: yahoo.write("[[Category:京畿道出身の人物]]\n") elif from1.find("慶尚南道") != -1: yahoo.write("[[Category:慶尚南道出身の人物]]\n") elif from1.find("慶尚北道") != -1: yahoo.write("[[Category:慶尚北道出身の人物]]\n") elif from1.find("済州特別自治道") != -1: yahoo.write("[[Category:済州特別自治道出身の人物]]\n") elif from1.find("忠清南道") != -1: yahoo.write("[[Category:忠清南道出身の人物]]\n") elif from1.find("忠清北道") != -1: yahoo.write("[[Category:忠清北道出身の人物]]\n") elif from1.find("全羅南道") != -1: yahoo.write("[[Category:全羅南道出身の人物]]\n") elif from1.find("全羅北道") != -1: yahoo.write("[[Category:全羅北道出身の人物]]\n") elif from1.find("大邱広域市") != -1: yahoo.write("[[Category:大邱広域市出身の人物]]\n") elif from1.find("咸鏡南道") != -1: yahoo.write("[[Category:咸鏡南道出身の人物]]\n") elif from1.find("咸鏡北道") != -1: yahoo.write("[[Category:咸鏡北道出身の人物]]\n") elif from1.find("平安南道") != -1: yahoo.write("[[Category:平安南道出身の人物]]\n") elif from1.find("平安北道") != -1: yahoo.write("[[Category:平安北道出身の人物]]\n") elif from1.find("平壌直轄市") != -1: yahoo.write("[[Category:平壌直轄市出身の人物]]\n") elif from1.find("黄海南道") != -1: yahoo.write("[[Category:黄海南道出身の人物]]\n") elif from1.find("釜山広域市") != -1: yahoo.write("[[Category:釜山広域市出身の人物]]\n") yahoo.write("[[Category:"+ymd[0]+"年生]]\n[[Category:存命人物]]\n\n") yahoo.write("[[ko:"+hangeul+"]]") print u"終了" if __name__ == '__main__': try: getbbresult() #statizresult1() #statizresult2() #statizresult3() statizresults() #main() finally: wikipedia.stopme() site = wikipedia.getSite()