How to I use a variable in telnetlib write? I can get connected no problem. I am new to python.
for line in ipaddress:
Host=line.strip("\n")
file = Host
connection.write(b"save configuration network" + file + "1.1.1.1 \n")I am setting file equal Host IP. This gives me an error stating I cannot concat a string to bytes. So file will chnage for every Host in ipaddress file. If I remove the '+' signs in line and one pair of double quotes, I get a backup file but the name is file. Error:Traceback (most recent call last):
File "C:\python_scripts\Backup_multi_lx.py", line 32, in <module>
connection.write(b"save configuration network" + file + "10.2.99.91 \n")
TypeError: can't concat str to bytes
