First commit
Former-commit-id: 424079609133edcc501ae185509836ee1181a02c
This commit is contained in:
BIN
name_code/web/File.data
Normal file
BIN
name_code/web/File.data
Normal file
Binary file not shown.
13
name_code/web/README.txt
Normal file
13
name_code/web/README.txt
Normal file
@ -0,0 +1,13 @@
|
||||
To run the demo, you can open the file demo.html from the browser "File/Open..." menu.
|
||||
|
||||
Another option is to start the built-in Python HTTP server by
|
||||
|
||||
python -m http.server
|
||||
|
||||
The default port is 8000. To specify another port:
|
||||
|
||||
python -m http.server 8080
|
||||
|
||||
Then load http://localhost:<port>/demo.html in the browser address bar.
|
||||
|
||||
For more information please visit http://brython.info.
|
45871
name_code/web/brython.js
Normal file
45871
name_code/web/brython.js
Normal file
File diff suppressed because it is too large
Load Diff
1
name_code/web/brython_stdlib.js.REMOVED.git-id
Normal file
1
name_code/web/brython_stdlib.js.REMOVED.git-id
Normal file
@ -0,0 +1 @@
|
||||
f9364c10f393b2389c3058f6ad0d40b4b5ba3077
|
1267
name_code/web/demo.html
Normal file
1267
name_code/web/demo.html
Normal file
File diff suppressed because it is too large
Load Diff
16
name_code/web/gen.py
Normal file
16
name_code/web/gen.py
Normal file
@ -0,0 +1,16 @@
|
||||
from pickle import dump
|
||||
opt={}
|
||||
base=0xa0a0
|
||||
for i in range(1,87+1):
|
||||
for j in range(1,94+1):
|
||||
t=base+(i<<8)+j
|
||||
t=t.to_bytes(2,'big')
|
||||
# print(t)
|
||||
try:
|
||||
opt[t.decode("gb2312")]='%02d%02d'%(i,j)
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
|
||||
print(opt["啊"])
|
||||
with open("File.data","wb") as f:
|
||||
dump(opt,f)
|
14
name_code/web/idx.py
Normal file
14
name_code/web/idx.py
Normal file
@ -0,0 +1,14 @@
|
||||
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)
|
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>
|
3
name_code/web/main.py
Normal file
3
name_code/web/main.py
Normal file
@ -0,0 +1,3 @@
|
||||
t=input("Name: ").encode("GB2312")
|
||||
for i in range(0,len(t),2):
|
||||
print("%02d%02d"%(t[i]-0xA0,t[i+1]-0xA0),end=" ")
|
33797
name_code/web/unicode.txt
Normal file
33797
name_code/web/unicode.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user