私はWebスクレイピング(PythonとBeautiful Soupで)を学習していますが、ループを含む関数内でデータをスクラップする方法に問題が発生しました。以下に示すように、私が取得しようとしているデータがあれば、else文の条件の範囲内である(下記のページのソース)ループを含む関数からデータを取り除くにはどうすればよいですか?
私はスクラップにしたい。「パスワード:h7s6sh」
**<SCRIPT>
function passWord() {
var testV = 1;
var pass1 = prompt('Please Enter Your Password',' ');
while (testV < 3) {
if (!pass1)
history.go(-1);
if (pass1.toLowerCase() == "ratedr")
{
alert('You Got it Right!');
document.write("<center><h1>Username : [email protected]<p>Password : h7s6sh</p></h1><p>NOTE : Visit daily Everyday</p><p><h1>Thank You!</h1></p></center>");break;
}
testV+=1;
var pass1 = prompt('Access Denied - Password Incorrect, Please Try Again.','Password');
}
if (pass1.toLowerCase()!="password" & testV ==3)
history.go(-1);
return " ";
}
</SCRIPT>**
これは私が
にしようとしているスクリプトです>>> script_mim.text
u'\nfunction passWord() {\nvar testV = 1;\nvar pass1 = prompt(\'Please Enter Your Password\',\' \');\nwhile (testV < 3) {\nif (!pass1) \nhistory.go(-1);\nif (pass1.toLowerCase() == "ratedr") {\nalert(\'You Got it Right!\');\ndocument.write("<center><h1>Username : [email protected]<p>Password : h7s6sh</p></h1><p>NOTE : Visit daily Everyday</p><p><h1>Thank You!</h1></p></center>");\nbreak;\n} \ntestV+=1;\nvar pass1 = \nprompt(\'Access Denied - Password enter code hereIncorrect, Please Try Again.\',\'Password\');\n}\nif (pass1.toLowerCase()!="password" & testV ==3) \nhistory.go(-1);\nreturn " ";\n} \n\n'
>>> script_mim.find_all( 'P')
[]
はなぜ何も表示されていませんか?私はpython 3.xの最新バージョンを使用しています。解決策を使って、私が間違っていることを教えてください。
フォーマットを少し整理して(特に以下のテキストを下に)もう少し詳細 - あなたのシナリオ、目標、そして正確な問題は何ですか?あなたの文脈の設定は何ですか?何のために何の言語を使っていますか? – bossi