In Python3 string.punctuation
— it is a pre-initialized string used as a string constant. In Python, string.punctuation
will give all sets of punctuation marks.
Syntax: string.punctuation
Parameters: Doesn’t take any parameter, since it’s not a function.
Returns: Return all sets of punctuation.
Note. Make sure to import the string.punctuation
library function to use string.punctuation
Code # 1:
|
Output:
! "# $% & amp;’ () * +, -./:;<="? @ [] ^ _ ’{|} ~
Code # 2: Punctuation check code is given.
|
Exit:
Punctuation :, Punctuation:! Punctuation :, Punctuation:?