On Mon, Jun 11, 2018 at 11:13 AM, Roberta Fagandini <[email protected]
> wrote:

>
>
> 2018-06-11 10:29 GMT+02:00 Moritz Lennert <[email protected]>:
>
>
>>
>>         - The code for reading this file can probably be simplified
>>           quite easily by using something like this:
>>
>>         for line in file(input_file):
>>                 a = line.split('=')
>>                 if len(a) <> 2 or a[0] not in ['blue', 'red', etc ]:
>>                         gscript.fatal("Syntax error in the txt file.")
>>                 a[1] = a[1].strip()
>>                 bands[a[0]] = a[1]
>>
>
> Thank you! this is a better solution than mine. It was a first experiment
> but I have already implemented your suggestion.
>


Please note that: In Python 2 "The forms <> and != are equivalent; for
consistency with C, != is preferred; where != is mentioned below <> is also
accepted. The <> spelling is considered obsolescent." In Python 3, there is
no <>, only !=.

https://docs.python.org/2.7/reference/expressions.html#comparisons
https://docs.python.org/3/reference/expressions.html#comparisons
_______________________________________________
grass-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to