var = "this is a string"
var = var.replace('a' , '')
var = var.split(' ')
print(var)
The above code displays:
['this','is','','string']
I want it to display:
['this','is','string']
How do I do that?
What have I tried: Assigning none to the Argument 2, but It raises an error 'TypeError: replace() argument 2 must be str, not None'