开发者

pexpect parse router output

I've got a couple of pexpect lines to log onto a cisco router, and issue the show arp command. I then exit the router, having stored the data into the variable myARP (myARP=child.before)

When I then try and loop over the object (for lines in myARP: print(lines), the info is displayed 1 character per line

l

i

k

e

t

h

i

s

Apologies as this is probably a very basic question, but why can't I display as it is shown if I issue the command manually? Is it to do with the streaming nature of the telnet connection? How c开发者_StackOverflow社区an this be resolved???


OK fixed - due to pexpects handling of line endings (/n/r) I think. Read Noahs usage docs for more info

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜