import geopandas as gpd
# 读取Shapefile
gdf = gpd.read_file("your_shapefile_path.shp")
# 转换为GeoJSON
geojson = gdf.to_json()
# 打印GeoJSON
print(geojson)
# 如果需要将GeoJSON保存到文件
with open('output_file.geojson', 'w') as f:
f.write(geojson)