БГ
Size: a a a
БГ
БГ
БГ
БГ
VA
𝕬
𝕬
БГ
class Row(str):
def __init__(self, d:dict):
super().__init__(" ".join(d.values()))
self.__d = d
def __getitem__(self, index):
if isinstance(index, int) or isinstance(index, slice):
return super().__getitem__(index)
else:
return self.__d[index]
𝕬
БГ
БГ
𝕬
БГ
𝕬
БГ
re.find(Row(...), ...)
и Row(...)[...]
IW
class Row(str):
def __init__(self, d:dict):
super().__init__(" ".join(d.values()))
self.__d = d
def __getitem__(self, index):
if isinstance(index, int) or isinstance(index, slice):
return super().__getitem__(index)
else:
return self.__d[index]
python3
from collections import UserString
class Row(UserString):
def __init__(self, d) -> None:
super().__init__(' '.join(d.values()))
self._d = d
a = {
'a': '1',
'b': "2",
'c': "3"
}
s = Row(a)
print(s)
print(s._d)
1 2 3
{'a': '1', 'b': '2', 'c': '3'}
БГ
БГ
python3
from collections import UserString
class Row(UserString):
def __init__(self, d) -> None:
super().__init__(' '.join(d.values()))
self._d = d
a = {
'a': '1',
'b': "2",
'c': "3"
}
s = Row(a)
print(s)
print(s._d)
1 2 3
{'a': '1', 'b': '2', 'c': '3'}
K