Answer the question
In order to leave comments, you need to log in
How to add an object from the config?
The bottom line is this:
You need to add text to this variable, from the
config Example (config):
[profile]
profile = 1
url = https://site.site/(profile)
https://site.site/1
:
Answer the question
In order to leave comments, you need to log in
import configparser # Стандартная библиотека Питона
config = configparser.ConfigParser()
config.read('config.ini')
profile_url = config['profile']['url'].replace('(profile)', config['profile']['profile'])
print(profile_url)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question