<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 11, 2018 at 11:13 AM, Roberta Fagandini <span dir="ltr"><<a href="mailto:robifagandini@gmail.com" target="_blank">robifagandini@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-">2018-06-11 10:29 GMT+02:00 Moritz Lennert <span dir="ltr"><<a href="mailto:mlennert@club.worldonline.be" target="_blank">mlennert@club.worldonline.be</a>></span><wbr>:<br></span><span class="gmail-"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
        - The code for reading this file can probably be simplified<br>
          quite easily by using something like this:<br>
<br>
        for line in file(input_file):<br>
                a = line.split('=')<br>
                if len(a) <> 2 or a[0] not in ['blue', 'red', etc ]:<br>
                        gscript.fatal("Syntax error in the txt file.")<br>
                a[1] = a[1].strip()<br>
                bands[a[0]] = a[1]<br></blockquote><div><br></div></span><div>Thank you! this is a better solution than mine. It was a first experiment but I have already implemented your suggestion.<br></div></div></div></div></blockquote><div><br></div><div><br></div><div>Please note that: In Python 2 "The forms <code class="gmail-docutils gmail-literal gmail-notranslate"><span class="gmail-pre"><></span></code> and <code class="gmail-docutils gmail-literal gmail-notranslate"><span class="gmail-pre">!=</span></code> are equivalent; for consistency with C, <code class="gmail-docutils gmail-literal gmail-notranslate"><span class="gmail-pre">!=</span></code> is
preferred; where <code class="gmail-docutils gmail-literal gmail-notranslate"><span class="gmail-pre">!=</span></code> is mentioned below <code class="gmail-docutils gmail-literal gmail-notranslate"><span class="gmail-pre"><></span></code> is also accepted.  The <code class="gmail-docutils gmail-literal gmail-notranslate"><span class="gmail-pre"><></span></code>
spelling is considered obsolescent." In Python 3, there is no <>, only !=.<br></div><div><br></div><div><a href="https://docs.python.org/2.7/reference/expressions.html#comparisons">https://docs.python.org/2.7/reference/expressions.html#comparisons</a></div><div><a href="https://docs.python.org/3/reference/expressions.html#comparisons">https://docs.python.org/3/reference/expressions.html#comparisons</a><br></div></div><br></div></div>