how to make the system call return the inverted string?

-1
print('Listening on {} {}'.format(ip,porta))
     (obj, cliente) = server.accept()
     print('connect received from {}'.format(cliente[0]))
    while (True):
        msg = obj.recv(1024)
        **system('rev')**
        server.close()
    
asked by anonymous 28.05.2018 / 01:59

1 answer

0

Use the command rev with | of bash:

echo 12345|rev

Return:

54321

That is: **system('{comando que retorna string}|rev')**

    
28.05.2018 / 02:40