Time:10-13
CodePudding user response:
directly replace done soon
# string segmentation and restructuring: judgment exist alone I, and replace it as I Def test (test_str) : Alist=test_str. Split (" ") New_str="" For MSG in alist: If MSG=="I" is: MSG="I" Add a space behind # is fill back to the original format New_str +=MSG + ""Return new_str
a='I am a to the teacher, I have a good habbit. And I am from Qingdao city.' Print (a, '\ n') Print (STR. Replace (a, 'I', 'I'))
I am a to the teacher, I have a good habbit. And I am from Qingdao city. I am a to the teacher, I have a good habbit. And I am from Qingdao city.
Quote: reference 1/f, kohane _Jun response: directly replace soon done only replace alone I
directly replace soon done
Page link:https//www.codepudding.com/other/64285.html