# Python字符串的应用


### 成员运算符 `in`的使用

##### 判断数据中是否存在你想要的成员

`A空格in空格B`

判断是否a在b中

not空格in也一样

-----------------

### 内置函数max

##### 返回数据中最大的成员

`max(数据)  返回成员值`

`print(max('今天是1月3日! '))`                          月

中文符号   >  字母  > 数字   >  英文符号  

中文按拼音的首字母计算

-------------------

### 内置函数min

##### 返回数据中最小的成员

`min(数据)  返回成员值`

`print(max('今天是1月3日! '))`                            !

中文符号   >  字母  > 数字   >  英文符号  

中文按拼音的首字母计算

```python
# coding:utf-8

info = 'python是一个非常有魅力的语言'

result = '魅力' in info
print(result)

result = '语言' not in info
print(result)

info2 = 'python is a good code'

print(max(info2))
print('.', min(info2), '.')

info3 = '天气好 要多锻炼身体'
info4 = '多锻炼身体 身体会变得更好'

print(info3 + info4)

new_str = info3 + info4 + '!'
print(new_str)
print(len(new_str))
length = len(new_str)
print(type(length))

```

-------------------

### 字符串的累加

字符串不是数字不能做减法 , 乘除法

字符串的拼接 , 用  "＋"这个符号

`a  =   '123'`                id(a)  等于107898032 

`b = '456'`

`c  =  a  =  b`

`print(c)   123456`

[若使用   a   =   a + b   

则之后id(a)       则输出为              80202416       ]

```python
# coding:utf-8

label = '欢迎来自远方的朋友'
name = 'jone'

pr = label + name

print(pr)

```

---------------

### input 语法

```python
# coding:utf-8

name = input('你的名字是:')
birthday = input('你的生日是:')
like_fruit = input('你喜欢的水果是:')
like_sport = input('你喜欢的运动是:')
like_animal = input('你喜欢的动物是:')

print('你的名字叫做: %s,出生于: %s,你喜欢的水果是: %s,最喜欢的运动为: %s,以及最喜欢的小动物是: %s' %
      (name, birthday, like_fruit, like_sport, like_animal))

```


