Python Forum
i found my very first Python code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i found my very first Python code
#1
while scanning through some old files in an archive, i ran across my very first Python code. i didn't know much about the language at the time. i did use the python command interactively as a calculator a lot even then. but coding this from a similar online template made me more curious what things meant and how it worked.
#!/usr/bin/env python

"""Get configuration from a Cisco router"""

import pexpect
import sys

child = pexpect.spawn('telnet 192.168.241.1')
child.expect('Password: ')

child.sendline('rumnnarb')
child.expect('#')

child.sendline('terminal length 0')
child.expect('#')

child.sendline('show running-config')
child.expect('#')
print child.before

child.sendline('exit')
child.expect('onnection closed')

if child.isalive():
    child.close()
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020