python - 删除特定的字符集?
问题描述
我知道这样的代码
translated1 = str(''.join( c for c in translated2 if c not in "[']" ))
将删除 [ 或 ' 或 ] 的任何实例,但我将如何对其进行编码以便它完全删除“---”。
我不希望它删除任何“-”实例,前提是这三个同时在一起。
我怎样才能做到这一点?谢谢!
解决方案
推荐阅读
- google-cloud-platform - gsutil parallel_composite_upload_threshold 的 Google Cloud JAVA SDK 替代品
- mysql - SQL 更新突然不起作用
- mysql - 从 Rails 中的 4 个连接表中获取数据
- swift - 无法使用有界流对执行流式请求
- android - Android OS 如何识别主线程上的网络调用并抛出 NetworkOnMainThreadException
- android - 我如何在 viewPager 上添加向上/向下滑动检测?
- firefox-developer-tools - 无法在 Firefox 开发人员工具中打开网络选项卡
- javascript - 如何在php中添加编辑按钮
- python - 在python中居中裁剪图像的最佳方法是什么?
- java - Spring 的 TestNG 回滚事务不起作用