regular expressions in openpyxl. format - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: regular expressions in openpyxl. format (/thread-25381.html) |
regular expressions in openpyxl. format - picnic - Mar-28-2020 In excell i have a column which contains several words. For my program I need only first one (and only letters). For example, cell -'dog,dogge', but we need only 'dog'. I made the programm but the form of output is very strange. Need your help what to change. My code: import openpyxl import re source_file=openpyxl.load_workbook((r’C:\Users\user\Desktop\Питон\Слова_английский.xlsx’)) first_sheet = source_file.worksheets[0] #активный первый лист column_b = first_sheet[‘B’] #столбец B for i in range(len(column_b)): keyRegex = re.compile(r'([а-яА-Я ]+)’) column_b_correct = keyRegex.search(str(column_b[i].value)) print(column_b_correct)I have the result: But I need only the words itself:
|