fork download
  1. text = "Hello. world. Hello!"
  2. chunks = text.split('.', 2) # split the text twice
  3. if len(chunks) > 2: # if there are more than 2 items
  4. print( fr'{".".join(chunks[0:2])}_{chunks[2]}' )
  5. else:
  6. print(text) # Replace the second dot or print the original
  7.  
Success #stdin #stdout 0.02s 9168KB
stdin
Standard input is empty
stdout
Hello. world_ Hello!