Looking for a way to count the string who have "#" as first character.
import re
def y():
with open('test.conf', 'r') as rf:
hitcount = 0
for line in rf:
if re.search(r'#*', line):
hit_count = hit_count + 1
print(hit_count)
when I used the script...it count all the string who have #, wherever it was place.
Below are the test.conf. The result should be only 4.
#config-version=FWF60C-5.02-FW-build754-170421:opmode=0:vdom=0:user=lorenzo.aspera
#conf_file_ver=42514
#buildno=0754
#global_vdom=1
config sy###stem global
END####