How can I make a for-loop loop through lines instead of characters in a variable?

后端 未结 1 1524
后悔当初
后悔当初 2020-12-04 03:37

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.

1条回答
  •  星月不相逢
    2020-12-04 04:03

    Use str.splitlines to split a string into lines:

    for line in data.splitlines():
        # Do things.
    

    0 讨论(0)
提交回复
热议问题