数据增强中遇到格式不统一问题,批量修改文件格式
```python
# coding:utf-8
import os
from PIL import Image
path = r'文件路径'
for file in os.listdir(path):
if file.endswith('.bmp'):
filename = os.path.join(path, file)
new_name = path +'\\' + file[:-4] + '.jpg'
img = Image.open(filename)
img.save(new_name)
del img
os.remove(filename)
pass