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

前端 未结 9 1808
你的背包
你的背包 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 05:06

    Almost there:

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

    _ is conventionally considered a don't-care variable.

提交回复
热议问题