plcopen/structures.py
changeset 2448 1367b796e129
parent 2441 c553769a65af
child 2453 9900a8df922f
equal deleted inserted replaced
2447:1c04a50dc7ff 2448:1367b796e129
    22 # along with this program; if not, write to the Free Software
    22 # along with this program; if not, write to the Free Software
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 
    24 
    25 
    25 
    26 from __future__ import absolute_import
    26 from __future__ import absolute_import
    27 import string
       
    28 import re
    27 import re
    29 from collections import OrderedDict
    28 from collections import OrderedDict
    30 
    29 
    31 from plcopen.plcopen import LoadProject
    30 from plcopen.plcopen import LoadProject
    32 from plcopen.definitions import *
    31 from plcopen.definitions import *
   102 
   101 
   103 def csv_file_to_table(file):
   102 def csv_file_to_table(file):
   104     """
   103     """
   105     take a .csv file and translate it it a "csv_table"
   104     take a .csv file and translate it it a "csv_table"
   106     """
   105     """
   107     return [map(string.strip, line.split(';')) for line in file.readlines()]
   106     table = [[column.strip()
       
   107               for column in line.split(';')]
       
   108              for line in file.readlines()]
       
   109     return table
   108 
   110 
   109 
   111 
   110 def find_section(section_name, table):
   112 def find_section(section_name, table):
   111     """
   113     """
   112     seek into the csv table to a section ( section_name match 1st field )
   114     seek into the csv table to a section ( section_name match 1st field )