English
Tamil Nadu Board of Secondary EducationHSC Science Class 12

How will you delete a string in Python? - Computer Science

Advertisements
Advertisements

Question

How will you delete a string in Python?

Short Note

Solution

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
  Is there an error in this question or solution?
Chapter 8: Strings and String manipulation - Evaluation [Page 130]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 12 TN Board
Chapter 8 Strings and String manipulation
Evaluation | Q 3. | Page 130
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×