1.

How will you delete a string in Python?

Answer»

Python will not allow deleting a particular character in a string. Whereas you can remove entire string variable using del command.

Example:

Code lines to delete a string variable

>>> str1= ”How about you”

>>> print (str1)

How about you

>>> del str1

>>> print (str1)

Name Error: name ‘str1’ is not defined



Discussion

No Comment Found