Last active
September 3, 2017 08:16
-
-
Save ShikiOkasaka/c1a42647cba3c93857ae9204bff3ba71 to your computer and use it in GitHub Desktop.
打鍵時間の測定データをテキストデータ化するためのスクリプト例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys | |
import os | |
from bs4 import BeautifulSoup | |
characters = " abcdefghijklmnopqrstuvwxyz;,./['LR" | |
def main(): | |
path = 'keytime.html' | |
if 2 <= len(sys.argv): | |
path = sys.argv[1] | |
content = '' | |
with open(path) as file: | |
content = file.read() | |
soup = BeautifulSoup(content, 'html5lib') | |
matrix = soup.select('#matrix')[0] | |
rows = matrix.findAll("tr") | |
i = 0 | |
for row in rows: | |
j = 0 | |
for cell in row.findAll(['td']): | |
if 1 <= i and i <= 34 and 1 <= j and j <= 34: | |
print(characters[i], characters[j], ' ', cell.get_text(), sep='') | |
j += 1 | |
i += 1 | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
つかいかたの例:
$ ./html2txt.py keytime.notepc.html > keytime.notepc.txt
参考: https://esrille.github.io/keyboard-layout-comparison/keytime.notepc.html