Working on 2017/09 part 2

This commit is contained in:
FrederikBaerentsen 2024-11-22 21:55:01 +01:00
parent 7a29670437
commit ef196af7e3
2 changed files with 19 additions and 3 deletions

View File

@ -4,7 +4,7 @@ from pprint import pprint
input_f = 'input'
part = -1
part = 2
#########################################
# #
# Part 1 #
@ -29,8 +29,17 @@ if part == 1:
#########################################
# #
# Part 2 #
# not working Part 2 #
# #
#########################################
if part == 2:
exit()
with open(input_f) as file:
for line in file:
print(line.rstrip(), end=' ')
clean_string = line.rstrip()
clean_string = re.sub(r"!.",'',clean_string)
print(clean_string)
clean_string = re.findall(r"<.*?>", clean_string)
for c in clean_string:
clean_string = c.replace('<','',1).replace('>','',1)
print(len(clean_string))

7
2017/09/test2 Normal file
View File

@ -0,0 +1,7 @@
<>
<random characters>
<<<<>
<{!>}>
<!!>
<!!!>>
<{o"i!a,<{i<a>