Advertisements
Advertisements
प्रश्न
How will you delete a string in Python?
टिप्पणी लिखिए
उत्तर
Python will not allow deleting a particular character in a string. Whereas you can remove the entire string variable using the del command.
Example:
Code lines to delete a string variable
>>> str1=”How about you”
>>> print (str1)
How about you
>>> del str1
>>> print (str1)
NameError: name ‘str1’ is not defined
shaalaa.com
Modifying and Deleting Strings
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?