Example:
def f1 (string1: str):
sentences = string1.split(". ")
sentences2 = [sentence[0].capitalize() + sentence[1:] for sentence in sentences]
string2 = '. '.join(sentences2)
return string2
print (f1("hello. my name is Joe. what is your name?"))
Output:
Hello. My name is Joe. What is your name?
Example:
import re
def sentence_case(text):
sentences = re.findall('[^.!?]+[.!?](?:\s|\Z)', text)
sentences = [x[0].upper() + x[1:] for x in sentences]
return ''.join(sentences)
print(sentence_case("hEllo. my name is Joe. what is your name?"))
Output:
HEllo. My name is Joe. What is your name?
def f1 (string1: str):
sentences = string1.split(". ")
sentences2 = [sentence[0].capitalize() + sentence[1:] for sentence in sentences]
string2 = '. '.join(sentences2)
return string2
print (f1("hello. my name is Joe. what is your name?"))
Output:
Hello. My name is Joe. What is your name?
Example:
import re
def sentence_case(text):
sentences = re.findall('[^.!?]+[.!?](?:\s|\Z)', text)
sentences = [x[0].upper() + x[1:] for x in sentences]
return ''.join(sentences)
print(sentence_case("hEllo. my name is Joe. what is your name?"))
Output:
HEllo. My name is Joe. What is your name?
No comments:
Post a Comment