0

For instance, I have a string that splits into 3 parts but I need just the first and third parts.

one, two, three = '1 2 3'.split()

After the above line, I would have to execute a "del" to remove it from variable list.

del(two) 

Is there a way I can discard "two" immediately? Like"

one, _, three = '1 2 3'.split()

Additionally, this is not a question about language semantics which has been answered in the following question.

What is the purpose of the single underscore "_" variable in Python?

This is a question if Python runtime has that feature to remove the variable automatically.

MFT
  • 1,405
  • 12
  • 11

0 Answers0