string.punctuation contains following characters:
‘!”#$%&\'()*+,-./:;<=>?@[\]^_`{|}~’
You can use translate and maketrans functions to map punctuations to empty values (replace)
import string 'AAA? BBB. CCC! DDD.EEE'.translate(str.maketrans('', '', string.punctuation))
Output:
'AAA BBB CCC DDDEEE'
Related Posts:
- working of \n in python [duplicate]
- Best way to strip punctuation from a string
- Python: TypeError: cannot concatenate ‘str’ and ‘int’ objects
- How to get the filename without the extension from a path in Python?
- sprintf like functionality in Python
- n-grams in python, four, five, six grams?
- Alphabet range in Python
- How do I lowercase a string in Python?
- How do I get a substring of a string in Python?
- Changing one character in a string
- How to read a file line-by-line into a list?
- What is lexicographical order?
- strip(char) on a string
- How to convert list to string [duplicate]
- TypeError: a bytes-like object is required, not ‘str’ when writing to a file in Python3
- Converting integer to string in Python
- Reverse a string in Python
- How do I compare two strings in python?
- Regex not operator
- Print string to text file
- Best way to convert string to bytes in Python 3?
- Extract substring in Bash
- How do I append one string to another in Python?
- How can I split and parse a string in Python?
- How to read a text file into a string variable and strip newlines?
- How to print like printf in Python3?
- string to string array conversion in java
- What is the difference between \r\n, \r, and \n? [duplicate]
- Python convert tuple to string
- write() versus writelines() and concatenated strings
- Why is it string.join(list) instead of list.join(string)?
- Why is it string.join(list) instead of list.join(string)?
- Split string with multiple delimiters in Python [duplicate]
- How to check if the string is empty?
- Split string on whitespace in Python
- How to check whether a str(variable) is empty or not?
- What does the ‘b’ character do in front of a string literal?
- Ignoring upper case and lower case in Java
- How to add a string in a certain position?
- Remove all special characters, punctuation and spaces from string
- This can be done without regex:
- Pythonic way to create a long multi-line string
- Convert columns to string in Pandas
- Generate random string/characters in JavaScript
- “[ ]” vs. “[[ ]]” in Bash shell
- How to delete a character from a string using Python
- Convert hex to binary
- Quoting backslashes in Python string literals
- Python string class like StringBuilder in C#?
- C – The %x format specifier
- How to check if a string is a substring of items in a list of strings?
- Best way to replace multiple characters in a string?
- How do I remove a substring from the end of a string?
- Detect whether a Python string is a number or a letter
- Finding all possible permutations of a given string in python
- How do I append one string to another in Python?
- AttributeError: ‘list’ object has no attribute ‘replace’ when trying to remove character
- AttributeError: ‘list’ object has no attribute ‘replace’ when trying to remove character
- How to convert string to binary?
- Converting from a string to boolean in Python?
- Count the number of occurrences of a character in a string
- What is the difference between ‘ and ” in JavaScript?
- How do I check if there are duplicates in a flat list?
- \n or \n in php echo not print [duplicate]
- How can I print variable and string on same line in Python?
- Mips how to store user input string
- bash : Bad Substitution
- Convert hex string to int in Python
- How can I find the first occurrence of a sub-string in a python string?
- Replacing a character from a certain index
- AttributeError: ‘list’ object has no attribute ‘lower’ gensim
- C++ Remove punctuation from String
- How to assign multiple lines string in Powershell Console
- How to get a function name as a string?
- Pandas error “Can only use .str accessor with string values”
- LC-3 STR with R1 as offset
- Convert a Unicode string to a string in Python (containing extra symbols)python string unicode type-conversion
- Create nice column output in python
- TypeError: decoding str is not supported
- AttributeError: ‘str’ object has no attribute ‘items’
- How to pad zeroes to a string?
- How can I process each letter of text using Javascript?
- How does str(list) work?
- What is the difference between a string and a byte string?
- How do I convert a string to a double in Python?
- How can I copy a Python string?
- How to strip a specific word from a string?
- Checking if a string can be converted to float in Python
- Passing string to a function in C – with or without pointers?
- Python cant convert ‘list’ object to str error [closed]
- Difference between char* and char** (in C)
- Using strip() to clean up a string
- Extract filename and extension in Bash
- Meaning of #{ } in Ruby?
- Python code to remove HTML tags from a string
- Cannot concatenate ‘str’ and ‘float’ objects?
- How to repeat individual characters in strings in Python
- Taking a new line using printf in java? Is %n correct?
- When to use %r instead of %s in Python? [duplicate]
- How to count instances of character in SQL Column