美文网首页
ascii字符字库

ascii字符字库

作者: 月下蓑衣江湖夜雨 | 来源:发表于2021-02-14 19:53 被阅读0次

ascii字符字库

类似这样

char 0x00
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........
........

char 0x01
........
........
..***...
.*...*..
*.....*.
*.*.*.*.
*.*.*.*.
*.....*.
*.....*.
*.*.*.*.
*..*..*.
.*...*..
..***...
........
........
........

char 0x02
........
........
..***...
.*****..
*******.
**.*.**.
**.*.**.
*******.
*******.
**.*.**.
***.***.
.*****..
..***...
........
........
........

转c语言数组

类似这样:

    // char 0x00
    0x0,
    0x0,
    0x0,
    0x0,
    0x0,
    0x0,
    0x0,
    0x0,
    0x0,
    0x0,
    0x0,
    0x0,
    0x0,
    0x0,
    0x0,
    0x0,
    // char 0x01
    0x0,
    0x0,
    0x38,
    0x44,
    0x82,
    0xaa,
    0xaa,
    0x82,
    0x82,
    0xaa,
    0x92,
    0x44,
    0x38,
    0x0,
    0x0,
    0x0,
    // char 0x02
    0x0,
    0x0,
    0x38,
    0x7c,
    0xfe,
    0xd6,
    0xd6,
    0xfe,
    0xfe,
    0xd6,
    0xee,
    0x7c,
    0x38,
    0x0,
    0x0,
    0x0,

python脚本

# -*- coding: utf-8 -*-
"""
Created on Sun Feb 14 16:34:49 2021

@author: zkai
"""

import string
import os

# 转二进制数字
def convert2Num( str ):
    ret = "0";
    for c in str:
        if c == '.':
            ret += '0';
        if c == '*':
            ret += '1';
    return int(ret, 2);


file = open("hankaku.txt") 
outFile = open('out.txt', 'w+')

for line in file:
    if "char" in line:
        print("// " + line.replace("\n", ""));
        outFile.writelines("    // " + line.replace("\n", "") + "\n");
    if "." in line or "*" in line:
        num = convert2Num(line);    
        hexStr = hex(num);
        print(hexStr);
        outFile.writelines("    " + hexStr + "," +  "\n");
file.close()
outFile.close();


相关文章

  • ascii字符字库

    ascii字符字库 类似这样 转c语言数组 类似这样: python脚本

  • 字符集、字符编码

    字符集 字符集 = 字库表 + 编码字符集 + 字符编码。 字库表:相当于所有可读或可显示字符的数据库、字库表决定...

  • ASCII对照表

    ASCII值|控制字符|ASCII值|控制字符|ASCII值|控制字符|ASCII值|控制字符---|---0|N...

  • url转义

    URL中的字符只能是ASCII字符,但是ASCII字符比较少,而URL则常常包含ASCII字符集以外的字符,如非英...

  • JavaScript 字符与 ASCII 编码的转换

    1. 方法 字符 → ASCII 码:StringValue.charCodeAt() ASCII 码 → 字符:...

  • SQL SERVER函数

    一、字符转换函数 1、ASCII() 返回字符表达式最左端字符的ASCII 码值。在ASCII()函数中,纯数字的...

  • SQL常用函数集锦

    一、字符转换函数 1、ASCII() 返回字符表达式最左端字符的ASCII码值。在ASCII()函数中,纯数字的字...

  • 关于mysql内置函数

    字符串函数 查看字符的ascii码值ascii(str),str是空串时返回0 查看ascii码值对应的字符cha...

  • MySQL字符串操作

    字符串函数 1、查看字符的ascii码值ascii(str),str是空串时返回0 select ascii('a...

  • JavaScript中使用ASCII码进行字符串大小写转换

    字符转ASCII码:str='a'; str.charCodeAt()ASCII码转字符:String.fromC...

网友评论

      本文标题:ascii字符字库

      本文链接:https://www.haomeiwen.com/subject/qtfuxltx.html