First commit
Former-commit-id: 424079609133edcc501ae185509836ee1181a02c
This commit is contained in:
36
name_code/web/index.html
Normal file
36
name_code/web/index.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script type="text/javascript" src="brython.js"></script>
|
||||
<script type="text/javascript" src="brython_stdlib.js"></script>
|
||||
</head>
|
||||
|
||||
<body onload="brython(1)">
|
||||
<div id="a">
|
||||
<input id="name"></input>
|
||||
<button id="check">确认</button></div>
|
||||
<div>
|
||||
<label id="ans">None</label>
|
||||
</div>
|
||||
<script type="text/python">
|
||||
from browser import document
|
||||
from pickle import load
|
||||
with open("File.data","rb") as f:
|
||||
d=load(f)
|
||||
def run(data):
|
||||
t=document["name"].value
|
||||
ans=""
|
||||
for i in range(len(t)):
|
||||
try:
|
||||
ans += d[t[i]]+" "
|
||||
except KeyError:
|
||||
document.alert("Can't convert '%s'."%(t[i]))
|
||||
document["ans"].text=ans
|
||||
document["check"].bind("click",run)
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user