loop in python not working for all line in text file

Hi
this code for get identity of mikrotik device. after run this code. only work for last IP

lines in ip.txt

192.168.3.6 → NET_6
192.168.3.8 → NET_8
192.168.3.10 → NET_10
import os
filename = ‘ip.txt’
with open(filename, ‘r’) as f:
for line in f:
pq = os.popen(‘plink -batch admin@’ + line + ’ -pw 123456@ “/system identity print”')
line = pq.readline()
print(line)
Using username “admin”.
Using username “admin”.

name: NET_10

indentation is significant in python. specifically loops in your case.

is indented, simply html do not show significant spaces (I do not check if is indented rightly)
new user do not know the use of [ code] blocks
import os
filename = ‘ip.txt’
with open(filename, ‘r’) as f:
for line in f:
pq = os.popen(‘plink -batch admin@’ + line + ’ -pw 123456@ “/system identity print”')
line = pq.readline()
print(line)