python punctuation

Solutions on MaxInterview for python punctuation by the best coders in the world

showing results for - "python punctuation"
Adam
19 Nov 2020
1import string 
2print (string.punctuation)          # !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
3sentence = "Hey guys !, How are 'you' ?"
4for i in sentence:
5    if i in string.punctuation:
6        print(i)  	 				# ! , ' ' ?
Perrie
09 Jan 2021
1Syntax : string.punctuation
2Parameters : Doesn’t take any parameter, since it’s not a function.
3Returns : Return all sets of punctuation.
4CASE: 1  
5# import string library function  
6import string  
7# Storing the sets of punctuation in variable result  
8result = string.punctuation  
9# Printing the punctuation values  
10print(result) 
11#OUTPUT : !"#$%&'()*+, -./:;<=>?@[\]^_`{|}~
12
13CASE: 2
14# import string library function  
15import string  
16    
17# An input string. 
18sentence = "Hey, Geeks !, How are you?"
19for i in sentence:   
20    # checking whether the char is punctuation. 
21    if i in string.punctuation: 
22        # Printing the punctuation values  
23        print("Punctuation: " + i) 
24   
25# Output:
26
27# Punctuation:,
28# Punctuation: !
29# Punctuation:,
30# Punctuation: ?
31
queries leading to this page
strings punctuations pythontake out punctuation pythonstrings punctuation pythonis punctuation pythonpython string punctuation examplepython get words from a string with punctuationput punctuation in python stringpython get words and punctuation in stringpython string punctuation get all punctuations in pythonpunctuation string pythonpython string punctuationstring punctuation python 3import punctuation pythonlist of punctuation in pythonhow to check punctuation in pythonpunctuation library pythonpython check for punctuationis punctuation in pythonafter punctuation string pythonpunctuation method in pythonall punctuation pythonhow change punctuation to one in string pythonhow make change punctuation in string pythonpython punctuation punctuation pythonpunctuation pythonhython punctuationstring punctuation python 5chow to use string punctuation in pythonimport punctuations pythonstring punctuation pythonfind punctuation in string pythonget punctuation pythonall the punctuation marks pythoncheck punctuation in string pythonpunctuation method pythonall punctuation in pythonpunctuation in pythonhow to use punctuation in python stringpython punctuations stringstrings punctuation in pythonpunctuation in python restring punctuations pythoncheck is string is punctuation pythonpython character is punctuationwhich type of punctuation is used in python when indicating a string literal 3fpunctuation symbols in pythonstring punctuation python examplepython punctuations stringswhat is string punctuation in pythonpython re punctuationpython find punctuation in stringpunctuation module pythoncan python variables have any punctuationimport string punctuation pythonpunctuation character in python languagepython string only letters punctuationget off of a string all punctuation pythonpunctuations in pythonpython punctuation string python punctuation of lettershow make change punctuation to one in string pythonpython string get all punctuationhow to print value and punctuation in pythonstring punctuation pythonpython punctuation markspython string all punctuationpython punctuation stringspunctuation in strings pythonpython is punctuationpython strin punctuationpunctuation from string pythonpython punctuation