good day everyone, so I have this problem, I have this script that counts the number of delimiters in the lines and then adds them to a new file / but I don't know how to do it, they need to remove the delimiter at the end
for example if I have text
input = "1:2:3 ThisIs,Test,"
the numbers present 1 book 2 chapter 3 verse and I want to add quarters and that is the number of characters (without the last character at the end of the text in line)
count delimiter add count two / I want them to be ignored at the end
with open('123.txt', encoding='utf-8') as input_file:
texts = input_file.readlines()
delimiters = ',.'
for text in texts:
count = 0
# We count the number of characters from the list of delimiters in the given line
for character in text:
if character in delimiters:
count += 1
# We add the number of characters from the delimiters list to the end of the line numbers
text_parts = text.split(' ')
text_parts[0] = text_parts[0] + ':' + str(count)
new_text = ' '.join(text_parts)
print(new_text, file=open(""+str("10000")+".txt", "a", encoding='utf-8'))
basically, what should I do to add the code after three numbers, the fourth number, for example, I have input
input = "1:2:3 ThisIs,Test,"
im search output = "1:2:3:1 ThisIs,Test,"
[,]
this last in text ignored