Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个字符串,它可以是任何名称,后跟.pdbor PDB。无论如何我可以在同一行代码中删除pdbor吗?PDB
.pdb
PDB
pdb
在不知道您试图解决什么问题的情况下,我只能给您一些提示:
你应该看看:
另一种可以提供更大灵活性的方法是使用正则表达式替换,例如:
re.sub(r'\.(pdb|PDB)', r'', filename);
或者,(?i)语法使整个正则表达式不区分大小写:
(?i)
re.sub(r'(?i)\.pdb', r'', filename);