How to get all the string punctuation characters in Python

3 Answers

0 votes
import string

print(string.punctuation)


'''
run:
  
!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

'''

 



answered Nov 8, 2018 by avibootz
0 votes
import string

for ch in string.punctuation:
    print(ch)


'''
run:
  
!
"
#
$
%
&
'
(
)
*
+
,
-
.
/
:
;
<
=
>
?
@
[
\
]
^
_
`
{
|
}
~

'''

 



answered Nov 8, 2018 by avibootz
0 votes
import string

print(string.punctuation[0])
print(string.punctuation[1])
print(string.punctuation[2])


'''
run:
  
!
"
#

'''

 



answered Nov 8, 2018 by avibootz
...