美文网首页
2020-01-30

2020-01-30

作者: 木马音响积木 | 来源:发表于2020-01-30 11:07 被阅读0次

    很多人,网上问,能不能给个 utf-8 占四个字节的汉字。
    为了你能搜索到, utf-8 , utf-8 , utf-8 , utf-8 , utf-8 , utf-8 , utf-8
    四个字节的汉字。
    四个字节的汉字。
    四个字节的汉字。
    四个字节的汉字。
    四个字节的汉字。
    四个字节的汉字。
    四个字节的汉字。

    用python 生成二进制文件,而后,你用utf-8 格式打开,自己找吧。
    请注意,生成的文件,大约有8M 。
    𡠁𡠂𡠃𡠄𡠅𡠆𡠐𡠑𡠒𡠓𡠔𡠕𡠖𡠠𡠡𡠢𡠣𡠤𡠥𡠦𡠰𡠱𡠲𡠳𡠴𡠵𡠶𡡀𡡁𡡂

    usepycharmopenit.png

    打开这个生成的文件,的工具,我用的是pycharm .

    具体python3 代码如下,抛砖引玉。有更好的代码,请告知。简信我。
    里面有很多当时的测试,都注释了。

    import binascii
    import os
    a=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"]
    a=["0","1"]   # to control the size of the file ,you can delete this line
    bb=["8","9","A","B"]
    cc=["0","1","2","3","4","5","6","7"]
    new=""
    head='EFBBBF'
    with open('f:\\56.py',"ab+") as f:
        utf8=binascii.a2b_hex(head)
        f.write(utf8)
    
    #11110000100000001000000010000001
    #F0808081
    #F7
    #81----bf
        #hs="e4b880"
        for a2 in cc:
            for a3 in bb:
                for a4 in a:
                    for a5 in bb:
                        for a6 in a:
                            for a7 in bb:
                                for a8 in a:
                                    new="F"+a2+a3+a4+a5+a6+a7+a8
                                    hb=binascii.a2b_hex(new)
                                    f.write(hb)
    '''  
        hs="F0808081"
        #hs="5B7F888489FEDA"
        hb=binascii.a2b_hex(hs)
        print(hb)
        f.write(hb)
    '''
    

    相关文章

      网友评论

          本文标题:2020-01-30

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