I have the following code to ssh to a node and find the RSSIs from other devices.
bot_ipv6 is a list of ipv6 addresses to ssh to and the script uses pexpect to ssh.
Use str.splitlines to split a string into lines:
for line in data.splitlines(): # Do things.