# Python 中文处理(2)

获取中文个数

```python
# -*- coding: UTF-8 -*-
import re

def search_text(inputdata):
    '''search返回匹配到的一个'''
    # TODO(You): 请在此实现代码
    return chi

def test():
    n = search_text('你好，nlp先生！nlp先生！')
    print(n)

if __name__ == '__main__':
    test()
```

请选出下列能**正确**实现这一功能的选项。

## template

```python
import re


def search_text(inputdata):
    '''search返回匹配到的一个'''
    chi = re.search('nlp', inputdata)
    return chi


def test():
    n = search_text('你好，nlp先生！nlp先生！')
    print(n)

if __name__ == '__main__':
    test()
```

## 答案

```python
chi = re.search('nlp', inputdata)
```

## 选项

### A

```python
chi = re.searchAll('nlp', inputdata)
```

### B

```python
chi = re.search(inputdata, 'nlp')
```

### C

```python
chi = inputdata.search('nlp')
```
