Hi, you might have found another way already- but split the string by the newline delimiter, and again by P using str.startswith(). For more string manipulation methods in the standard Python library refer to:
string — Common string operations — Python 3.9.1rc1 documentation
e.g.
lines = Hello.split("\n")
matches = list(filter(lambda line: line.startswith("P"), lines)
# ALTERNATIVELY: ignore leading whitespace
# matches = list(filter(lambda line: line.lstrip().startswith("P"), lines)
print("\n".join(matches))