Basic Functions
Using python write basic functions for convertor
import re
import string
def generate_letter_code():
# All lower case
letters = string.ascii_lowercase
i = 1
while True:
# All the combination of lenght of i using letters
for combination in product(letters, repeat=i):
yield ''.join(combination)
i += 1
def get_lstrip(astr):
return astr[:len(astr) - len(astr.lstrip())]
def get_split(line_string):
# 定义正则表达式
pattern = r"([-]{2,}>)"
# 使用 re.findall 提取匹配的部分
return re.findall(pattern, line_string)
def get_items(line_string):
return list(map(lambda x: x.strip(), re.split(r"[-]{2,}>", line)))
January 6, 2025Less than 1 minute