python character is punctuation code example
Example 1: python punctuation
import string
print (string.punctuation)
sentence = "Hey guys !, How are 'you' ?"
for i in sentence:
if i in string.punctuation:
print(i)
Example 2: string punctuation python
Syntax : string.punctuation
Parameters : Doesn’t take any parameter, since it’s not a function.
Returns : Return all sets of punctuation.
CASE: 1
import string
result = string.punctuation
print(result)
CASE: 2
import string
sentence = "Hey, Geeks !, How are you?"
for i in sentence:
if i in string.punctuation:
print("Punctuation: " + i)