Saturday, 15 August 2015

python - Import/Export based on conditions -



python - Import/Export based on conditions -

imagine settings.py:

if condition: a_setting = true else: a_setting = false

how can have file import , setting based on condition:

import settings use_setting_somehow(settings.a_setting)

update: ignore please. had error in function.

retrieving value depends on particular status should getter in stead of settings variable.

def get_setting(setting): if condition: homecoming 1 else: homecoming 'a' import settings settings.get_setting('blarp')

python

No comments:

Post a Comment