我有一组字符串set1,并且其中的所有字符串set1都有两个不需要并且想要删除的特定子字符串。 输入示例: set1={'Apple.good','Orange.good','Pear.bad','Pear.good','Banana.bad','Potato.bad'} 所以基本上我希望从所有字符串中删除.good和.bad子字符串。我试过的 for x in set1: x.replace('.good','') x.replace('.bad','') 但这似乎根本不起作用。输出绝对没有变化,它与输入相同。我尝试使用for x in list(set1)而不是原始版本,但没有任何改变。
我已经设置了一个新的空白反应本机应用程序。 安装了几个节点模块后,出现此错误。 Running application on PGN518. internal/fs/watchers.js:173 throw error; ^ Error: ENOSPC: System limit for number of file watchers reached, watch '/home/badis/Desktop/react-native/albums/node_modules/.staging' at FSWatcher.start (internal/fs/watchers.js:165:26) at Object.watch (fs.js:1253:11) at NodeWatcher.watchdir (/home/badis/Desktop/react-native/albums/node modules/sane/src/node watcher. js:175:20) at NodeWatcher.<anonymous> (/home/badis/Desktop/react-native/albums/node modules/sane/src/node watcher. js:310:16) at /home/badis/Desktop/react-native/albums/node modules/graceful-fs/polyfills.js:285:20 at FSReqWrap.oncomplete (fs.js:154:5) 我知道这与看守人没有足够的空间来监视所有文件更改有关。 我想知道最好的行动方法是什么? 我应该node_modules通过将其添加到文件夹来忽略它.watchmanconfig吗?