I am trying to construct the command which includes the variable containing IP addresses to the subprocess but the variable is not passed.
with open('iplist', 'r', encoding="utf-8") as f:
data = f.read()
cmd = ['./mmdbinspect', '--db', '/usr/local/var/GeoIP/GeoLite2-City.mmdb', '$data']
result = subprocess.run(cmd, stdout=subprocess.PIPE)
2020/11/01 10:06:13 could not get records from db /usr/local/var/GeoIP/GeoLite2-City.mmdb: $data is not a valid IP address