@@ -0,0 +1,1278 @@
+import gen_key%0Aimport sys%0Acomargs = sys.argv%0AoutName = comargs%5B1%5D%0AkeyName = comargs%5B2%5D%0AMessage = comargs%5B3%5D%0A%0Adef encode(text):%0A    if type(text) == str and text.isalpha():%0A        text=text.upper()%0A        message = list(text)%0A        length = len(message)%0A        n = gen_key.loadKey(keyName)%0A        Result = %5B%5D%0A        for item in message:%0A            result = %5B%5D%0A            times = n%5Bitem%5D%0A            for t in range(0,times):%0A                result.append('a')%0A            Result.append(result)%0A        return Result%0A    else: return 'please enter a text message with all alphabets'%0A%0Adef saveMessage(mes,fileN):%0A    import pickle%0A    f1 = file(fileN+'.pkl', 'wb')%0A    pickle.dump(mes, f1, True)%0A    f1.close %0A%0Adef loadMessage(fileN):%0A    import pickle%0A    f2 = file(fileN+'.pkl', 'rb')%0A    mes = pickle.load(f2)%0A    f2.close%0A    return mes%0A%0Adef Test():%0A    print '%5Cn'%0A    print ' The key of this encode: ', gen_key.loadKey(keyName)%0A    print ' Encode the message (', Message,') ', encode(Message)%0A    mes = encode(Message)%0A    saveMessage(mes,outName)%0A    print ' View the information in the file -', outName,'- which save the encoded message: '%0A    print ' With pickle.load method'%0A    print loadMessage(outName)%0A    print '%5Cn'%0A%0Aif __name__ == '__main__':%0A    Test()%0A   %0A

Create encode.py