2021年3月26日星期五

Python how to replace 1 string with either of 2 strings

Say I've this

string = SSTTFSSFFST

Now I want to replace every F's with either X or Y so the result is like using python 3x:

new_string =  SSTTXSSXXST, SSTTXSSXYST, SSTTXSSYXST, SSTTXSSYYST, SSTTYSSXXST, SSTTYSSXYST, SSTTYSSYXST, SSTTYSSYYST  
https://stackoverflow.com/questions/66827918/python-how-to-replace-1-string-with-either-of-2-strings March 27, 2021 at 12:07PM

没有评论:

发表评论