On Apr 7, 9:38 am, [EMAIL PROTECTED] wrote:
> Folks,
> Is it possible to read hash values from txt file.
> I have script which sets options. Hash table has key set to option,
> and values are option values.
>
> Way we have it, we set options in a different file (*.txt), and we
> read from that file.
> Is there easy way for just reading file and setting options instead of
> parsing it.
>
> so this is what my option files look like:
>
> 1opt.txt
> { '-cc': '12',
>   '-I': r'/my/path/work/'}
>
> 2opt.txt
> {  '-I': r/my/path/work2/'}
>
> so my scipt how has dictionary
> options = { '-cc' :'12'
>                 '-I': r'/my/path/work/:/my/path/work2/'}
>
> I am trying to avoid parsing

With minimal changes, you can just import the files:

opt1.py
------
opts = { '-cc': '12',
  '-I': r'/my/path/work/'}


opt2.py
------
opts = {  '-I': r/my/path/work2/'}


main.py
-------
from opts1 import opts as opt1
from opts2 import opts as opt2


Raymond
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to