- 1

Is there a function for string difference? If yes, is it '-'?

Or strDifference? (Because there is strIntersection)

5th Aug 2017, 6:06 AM
Matthew Li
Matthew Li - avatar
2 Answers
+ 4
To compute 'differences' of string, you can use the standard module 'difflib': << The difflib module contains tools for computing and working with differences between sequences. It is especially useful for comparing text, and includes functions that produce reports using several common difference formats. >> https://pymotw.com/2/difflib/ Then, you have many ways to update strings... If you only want to 'substract' one string from another, the @Hatsy Rei link show some ways without use of difflib ;)
5th Aug 2017, 7:44 AM
visph
visph - avatar