The question is published on by Tutorial Guruji team.
i have a .properties file that states
server-ip= and i made a python program that identifies my ipv4, but i want it to go to the proprieties file through the same program and get
import socket socket.gethostbyname(hostname)
I’ve tired many diferent types of solutions, please a need help
If .properties doesn’t have sections (usually doesn’t) you could check this answer: – link
Else, you could use configParser:
import configparser config = configparser.ConfigParser() config.read('filename') host = config['section-name']['server-ip']