I am new in python, and I really need some help. I am doing this memory game where I need to save user, game score and time into a text file using python. I have tried several ways to do it, but nothing seems to work. I need to get the text what is shown after game on html page (statsParagraph) into *txt file using python In my html code I have this:
<form action="http://....python file addres" method="GET">
<p id="statsParagraph" name="user" value=""></p>
</form>
in my javascript code I have this:
function showstatistic(){
var user = prompt ("What is your name?","");
alert (user + ". game is over!")
var s="";
for(var i=0;i<statistic.length;i++){
var t=statistic[i].time;
var timeString= (t-(t%60))/60+":"+(t%60);
s += "User: " + user
+" <br/>"
+ " Game #"+ (i+1) +" "
+" <br/>"
+" Guessed: "+ statistic[i].guessed
+" <br/>"
+" Minus points: "+ statistic[i].minuses
+" <br/>"
+" Guessed right: "+ statistic[i].plusPoints
+" <br/>"
+" Time: "+ timeString
+" <br/>"
+" <br/>";
}
$("#statsParagraph").html(s);
}
See Question&Answers more detail:os