1. Python / Говнокод #25806

    −2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    hxStr = []
    for x in range(256):
        hxStr.append('{:02X}'.format(x))
    ascChr = []
    for i in range(32, 128):
        ascChr.append(chr(i))
    data = [
        0xBE, 0xEF, 0xDE, 0xAD
    ]
    lines = (len(data)//16)
    if len(data)%16 != 0:
        lines += 1
    i = 0
    pr = ''
    for x in range(lines):
        pr += "{:000000008X}{:1}|{:1}".format(x*16,'','')
        btes = []
        symbs = []
        for y in range(i,i+16,1):
            if y >= len(data):
                for x in range((lines*16)-y):
                    symbs.append(' ')
                    btes.append(' ')
                break
            if chr(data[y]) in ascChr:
                symbs.append(chr(data[y]))
            else:
                symbs.append('∙')
            btes.append(hxStr[data[y]])
        i = y+1
        for y in range(len(btes)):
            pr += "{:3}".format(btes[y])
        pr += '|{:1}'.format('')    
        for y in range(len(symbs)):
            pr += "{:1}".format(symbs[y])
        pr += '\r\n'    
    print("{:9}|{:1}0{:2}1{:2}2{:2}3{:2}4{:2}5{:2}6{:2}7{:2}8{:2}9{:2}A{:2}B{:2}C{:2}D{:2}E{:2}F{:2}|\
    {:1}0123456789ABCDEF".format('Offset','','','','','','','','','','','','','','','','','','',''))    
    print(pr)

    наваял типа 16ричный вьювер

    Запостил: MegaCrap, 05 Сентября 2019

    Комментарии (25) RSS

    Добавить комментарий