[Canvas绘图] 第26节 生成表格
来源:互联网 发布:淘宝店铺logo尺寸大小 编辑:程序博客网 时间:2024/05/17 06:00
本节目标:
(1) 绘制一张Python标准库模块索引表
(2) 我用了下面这个函数
(1) 绘制一张Python标准库模块索引表
实现步骤:
(1) 我有下面这样一堆字符串,我想把它们放到表格中
"__future__", "__main__", "_dummy_thread", "_thread","abc", "aifc", "argparse", "array", "ast", "asynchat", "asyncore","atexit", "audioop", "base64", "bdb", "binascii", "binhex", "bisect", "builtins", "bz2","calendar", "cgi", "cgitb", "chunk", "cmath", "cmd", "code","codecs", "codeop", "collections", "colorsys", "compileall", "concurrent", "configparser", "contextlib", "copy", "copyreg", "cprofile","csv", "ctypes", "detetime", "dbm", "decimal", "difflib", "dis", "distutils", "doctest","dummy_threading","email", "encoding", "errno","faulthandler", "filecmp", "fileinput", "fnmatch", "formatter", "fractions","ftplib", "functools", "gc", "getopt", "getpass", "gettext", "glob", "gzip","hashlib", "heapq", "hmac", "html", "http","imaplib", "imghdr", "imp", "importlib", "inspect", "io", "ipaddress", "itertools", "json","keyword","lib2to3", "linecache", "locale", "logging", "lzma", "macpath", "mailbox", "mailcap", "marshal", "math", "mimetypes", "mmap","modulefinder", "multiprocessing","netrc", "nntplib", "numbers", "operator", "optparse", "os", "parser", "pdb", "pickle", "pickletools", "pkgutil", "platform", "plistlib","poplib", "pprint", "profile", "pstats", "py_compile", "pyclbr", "pydoc","queue", "quopri", "random", "re", "reprlib", "rlcompleter", "runpy","sched", "select", "shelve", "shlex", "shutil", "signal", "site","smtpd", "smtplib", "sndhdr", "socket", "socketserver", "sqlite3","ssl", "stat", "string", "stringprep", "struct", "subprocess","sunau", "symbol", "symtable", "sys", "sysconfig", "tabnanny", "tarfile", "telnetlib", "tempfile", "test", "textwrap","threading", "time", "timeit", "tkinter", "token", "tokenize", "trace","traceback", "turtle", "types", "unicodedata", "unittest", "urllib", "uu", "uuid", "venv","warnings", "wave", "weakref", "webbrower", "wsgiref","xdrlib", "xml", "xmlrpc", "zipfile", "zipimport", "zlib"
(2) 我用了下面这个函数
/*** @usage 生成索引表* @author mw* @date 2015年12月13日 星期日 11:49:22 * @param* @return**/function mytable() {var table = $$("table");var caption = table.createCaption();caption.innerHTML="Python标准库模块索引表" +"<p>";//找<tbody>var node = table.firstChild;while (null != node) {/*想知道都有哪些子节点,用这个var text = document.createTextNode(node.nodeName);document.body.appendChild(text);*/if ("TBODY" == node.nodeName) break;node = node.nextSibling;}var arr = new Array("__future__", "__main__", "_dummy_thread", "_thread","abc", "aifc", "argparse", "array", "ast", "asynchat", "asyncore","atexit", "audioop", "base64", "bdb", "binascii", "binhex", "bisect", "builtins", "bz2","calendar", "cgi", "cgitb", "chunk", "cmath", "cmd", "code","codecs", "codeop", "collections", "colorsys", "compileall", "concurrent", "configparser", "contextlib", "copy", "copyreg", "cprofile","csv", "ctypes", "detetime", "dbm", "decimal", "difflib", "dis", "distutils", "doctest","dummy_threading","email", "encoding", "errno","faulthandler", "filecmp", "fileinput", "fnmatch", "formatter", "fractions","ftplib", "functools", "gc", "getopt", "getpass", "gettext", "glob", "gzip","hashlib", "heapq", "hmac", "html", "http","imaplib", "imghdr", "imp", "importlib", "inspect", "io", "ipaddress", "itertools", "json","keyword","lib2to3", "linecache", "locale", "logging", "lzma", "macpath", "mailbox", "mailcap", "marshal", "math", "mimetypes", "mmap","modulefinder", "multiprocessing","netrc", "nntplib", "numbers", "operator", "optparse", "os", "parser", "pdb", "pickle", "pickletools", "pkgutil", "platform", "plistlib","poplib", "pprint", "profile", "pstats", "py_compile", "pyclbr", "pydoc","queue", "quopri", "random", "re", "reprlib", "rlcompleter", "runpy","sched", "select", "shelve", "shlex", "shutil", "signal", "site","smtpd", "smtplib", "sndhdr", "socket", "socketserver", "sqlite3","ssl", "stat", "string", "stringprep", "struct", "subprocess","sunau", "symbol", "symtable", "sys", "sysconfig", "tabnanny", "tarfile", "telnetlib", "tempfile", "test", "textwrap","threading", "time", "timeit", "tkinter", "token", "tokenize", "trace","traceback", "turtle", "types", "unicodedata", "unittest", "urllib", "uu", "uuid", "venv","warnings", "wave", "weakref", "webbrower", "wsgiref","xdrlib", "xml", "xmlrpc", "zipfile", "zipimport", "zlib");//单元格插入var tr = null;var td = null;var cell = null;var col = 0;while (arr.length > 0) {//插入<tr>tr = document.createElement("tr");for (; col < 6; col++) {//插入<td> td = document.createElement("td");cell = document.createTextNode(arr.shift());td.appendChild(cell);tr.appendChild(td);if (arr.length <=0) break;}node.appendChild(tr);col = 0;}}
目标完成,下一节继续我的python学习。
0 0
- [Canvas绘图] 第26节 生成表格
- [Canvas绘图] 第01节 画布准备
- [Canvas绘图] 第03节 “矩”重若轻
- [Canvas绘图] 第04节 多边家族
- [Canvas绘图] 第05节 火柴天堂
- [Canvas绘图] 第06节 车轮滚滚
- [Canvas绘图] 第08节 "8"解九妹
- [Canvas绘图] 第10节 图片加载
- [Canvas绘图] 第11节 四大美人
- [Canvas绘图] 第12节 帅哥降临
- [Canvas绘图] 第13节 线条勾勒
- [Canvas绘图] 第16节 路见不平
- [Canvas绘图] 第27节 三维初探
- [Canvas绘图] 第29节 葵花点穴
- [Canvas绘图] 第30节 沙场点兵
- [Canvas绘图] 第31节 连通实验
- [Canvas绘图] 第02节 今日看“点"
- [Canvas绘图] 第07节 “星“心相映
- spring自定义异常
- Codevs_P1021 热浪(Dijkatra)
- IntelliJ IDEA 使用笔记
- [c++ 温故知新]类内char* 指针内存分配长度
- C++的string二三事
- [Canvas绘图] 第26节 生成表格
- Vivado中用HDL定义BRAM存储器并用updatemem合成bit文件
- 正则表达式
- 1010: [HNOI2008]玩具装箱toy
- 性格对咱的影响
- #pragma 预处理指令详解
- bzoj2034[2009国家集训队]最大收益
- Spring AOP 应用 - 打印 Action (Controller )层的日志信息
- 关于MYSQL数据库乱码问题解决方案