<li>Password: <strong>FD433g</strong></li>Как оставить только FD433g ?
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import io import urllib import re username = u'Username' password = u'Password' with io.open('1.html', encoding='utf-8') as file: for line in file: if username in line: print(line, end='') if password in line: print(line, end='')