ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 0x16.Changer
    0x.프로그래밍/Python 2017. 12. 7. 15:00

    0x16.Changer



    1. Hex Encode

    2. Hex Decode

    3. ASCII Encode

    4. ASCII Decode


    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    def main():
        while True:
            print '================='
            print 'Changer by pwnWiz'
            print '================='
            print 'Choose the Option'
            print '1. Hex Encode'
            print '2. Hex Decode'
            print '3. ASCII Encode'
            print '4. ASCII Decode'
            print 'Other to exit'
            print '================'
     
            menu=raw_input()
            if menu>'4' :
                print 'bye~'
                break
            if menu<'0':
                print 'bye~'
                break
            print 'input the word to convert'
            code=raw_input()
            print 'result :-'
            if(menu=='1'):
                try :
                    print '0x' + code.encode("hex")
                except :
                    print 'Sorry, error'
            elif(menu=='2'):
                try :
                    print code.decode("hex")
                except :
                    print 'Sorry, error'
            elif(menu=='3'):
                try :
                    print ord(code)
                except :
                    print 'Sorry, error'
            elif(menu=='4'):
                try :
                    print chr(int(code))
                except :
                    print 'Sorry, error'
            else:
                print 'Sorry, error'
                exit()
     
     
    main()
     
    cs


    '0x.프로그래밍 > Python' 카테고리의 다른 글

    0x17.Python int Casting  (0) 2018.12.12
    0x15.달팽이 배열(Spiral Array)  (0) 2017.07.24
    0x14.카드 역배치  (0) 2017.07.19
    0x13.Jolly Jumpers  (0) 2017.07.14
    0x12.피보나치 수열  (0) 2017.07.12

    댓글

Designed by Tistory.