YU Bo wrote: > ```text > The registers rax, rcx and rdx are touched when controlling IBRS > so they need to be saved when they can't be clobbered. > > diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h > index 45a63e0..3b9b238 100644 > ... > ``` > I want to delete string from *diff --git* to end, because too many code is > here
Use str.split() or str.partition() and only keep the first part: >>> text = """The registers rax, rcx and rdx are touched when controlling IBRS ... so they need to be saved when they can't be clobbered. ... ... diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h ... index 45a63e0..3b9b238 100644 ... """ >>> cleaned_text = text.partition("diff --git")[0].strip() >>> print(cleaned_text) The registers rax, rcx and rdx are touched when controlling IBRS so they need to be saved when they can't be clobbered. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor