from dataclasses import dataclass
@dataclass
class Element:
name: list
leg: list
itog: list
material: list
primechanie: list
vrezki: list
objLegVrez: list
gib: list
count: list
def getRow(letter):
i = 15
u = 0
arr = []
while i < 1000:
i = i + 1
u = u + 1
if (sheet[letter + str(i)].value != None):
arr.append(sheet['I' + str(i)].value)
else:
break
return arr
el_1 = Element(
name=getRow("I"),
leg=getRow("J"),
itog=getRow("K"),
material=getRow("L"),
primechanie=getRow("M"),
vrezki=getRow("N"),
objLegVrez=getRow("O"),
gib=getRow("P"),
count=getRow("Q")
)
import re
import string
value = 'Hel12o 16e15ple'
for number in re.findall(r'[0-9]+', value):
value = value.replace(number, string.ascii_lowercase[int(number) - 1])
import string
from typing import List
def find_numbers(string: str) -> List[int]:
temp_string = ''
numbers = []
for char in string:
if char.isdigit():
temp_string += char
elif temp_string:
numbers.append(int(temp_string))
temp_string = ''
return numbers
value = 'Hel12o 16e15ple'
for number in find_numbers(value):
value = value.replace(str(number), string.ascii_lowercase[number - 1])
latin="abcdefghijklmnopqrstuvwxyz"
text = input("Введите строку: ")
i = 0
s = ""
while i < len(text):
a = text[i]
while "0" <= a <= "9":
s += a
i += 1
if i < len(text):
a = text[i]
else:
break
i += 1
if s != "":
#print(type(s))
text = text.replace(s,latin[int(s)-1])
if len(s) > 1:
i -= len(s) - 1
s = ""
latin = "abcdefghijklmnopqrstuvwxyz"
text = input("Введите строку: ")
i = 0
s = ""
for a in text:
if "0" <= a <= "9":
s += a
continue
elif s != "":
text = text.replace(s, latin[int(s)-1])
s = ""
html = '''
<tbody>
<tr>
<td>Содержимое 1</td>
<td>Содержимое 2</td>
</tr>
<tr>
<td>Содержимое 3</td>
<td>Содержимое 4</td>
</tr>
</tbody>
'''
soup = BeautifulSoup(html, 'lxml')
result = []
tr_elems = soup.find_all('tr')
for tr in tr_elems:
result.append([td.text for td in tr.find_all('td')])
# [['Содержимое 1', 'Содержимое 2'], ['Содержимое 3', 'Содержимое 4']]