在给定的HTML代码中查找所有标题元素，并以相应的级别打印它们的文本内容。


HTML代码：
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<h2>My Second Heading</h2>
<h3>My Third Heading</h3>
</body>
使用适当的库（如BeautifulSoup），可以按以下方式解析HTML代码并获取标题元素的文本内容：

```
from bs4 import BeautifulSoup

html_code = '<head><title>Page Title</title></head><body><h1>My First Heading</h1><h2>My Second Heading</h2><h3>My Third Heading</h3></body>'
soup = BeautifulSoup(html_code, 'html.parser')

for num in range(1, 4):
    headings = soup.find_all('h' + str(num))
    for heading in headings:
        print(f'Level {num}: {heading.text}')
```

输出：

```
Level 1: My First Heading
Level 2: My Second Heading
Level 3: My Third Heading
```