Python - is there a “don't care” symbol for tuple assignments?

前端 未结 9 1961
你的背包
你的背包 2020-12-03 04:17

Given a string \"VAR=value\" I want to split it (only) at the first \'=\' sign (< value > may contain more \'=\' signs), something like this:

<         


        
9条回答
  •  被撕碎了的回忆
    2020-12-03 04:52

    As others have said, underscore (_) is the standard. But if underscore is being used for translations, I think double underscore is the best alternative.

    var, __, value = "VAR=value".partition('=')

    Better than these:

    var, unused, value = "VAR=value".partition('=')

    var, unused_del, value = "VAR=value".partition('=')

    var, _del, value = "VAR=value".partition('=')

提交回复
热议问题