How do i reverse an input string with python in ROS

asked 2022-04-15 06:04:45 -0500

i want to convert an input collected from a topic and print out the reverse of it, eg Python-->nohtyP ive coded this in python txt = data[::-1] print(txt) where data comes from the topic, but i am thrown a Type error: 'string' object is not subscriptable. it seems the ROS library 'string' cannot be handled the same way as it is in python. are there any alternate methods to this?

edit retag flag offensive close merge delete