Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 772263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:46:50+00:00 2026-05-14T18:46:50+00:00

Given a string VAR=value I want to split it (only) at the first ‘=’

  • 0

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

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

Is there a way to NOT declare a variable ‘sep’? Like this (just made up the syntax):

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

Just for completeness, I’m targetting Python v 2.6

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:46:51+00:00Added an answer on May 14, 2026 at 6:46 pm

    _ is indeed a very popular choice for “a name which doesn’t matter” — it’s a legal name, visually unobtrusive, etc. However sometimes these very qualities can hinder you. For example, the GNU gettext module for I18N and L10N, which is part of Python’s standard library, idiomatically uses _ very differently, with idioms such as…:

    _ = gettext.gettext
    # ...
    print _('This is a translatable string.')
    

    to mark and translate all the literal-string messages in the code (also exploiting the relative visual unobtrusiveness of _('...'). Obviously any code using this module and idiom shouldn’t also be using _ to mean something completely different (“a don’t care name”).

    So a second useful alternative can be to devote the name unused to indicate such “don’t care” situations in a visually more explicit way. Google’s python style guide recommends using either _ or a prefix of unused_ — the latter can be a bit verbose but tends to be very clear, e.g.:

    name, unused_surname, salutation = person_data
    print "Hello, %s %s!" % (salutation, name)
    

    makes crystal-clear that person_data is a three-item sequence (probably a tuple) and the item you’re skipping (and not using at all) is the surname (because you want to print a friendly message like “Hello, Mr Alex!” or “Hello, Miss Piggy!” ;-). (pylint and similar tools can warn you if you have unused variables named otherwise than _ or unused_..., and of course also warn you if you ever do use a variable named unused_something!-).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm in need to modify a given string to contain only alpha numerical characters,
Given a string like the following in JavaScript var a = 'hello world\n\nbye world\n\nfoo\nbar\n\nfoo\nbaz\n\n';
Given this code: var arrayStrings = new string[1000]; Parallel.ForEach<string>(arrayStrings, someString => { DoSomething(someString); });
function superman(){ //some code var opitem = $(#opinionitem).html(); opitem.replace(:opinionid,valid string); //more code } gives
Given I have: $(a.clickable).livequery('click', (function (e) { var values = $(this).attr('id').split('_'); $('#' + values[3]).load($(this).attr('href'));
I'm trying to compress any given string to a shorter version, copy paste-able compressed
Possible Duplicate: how to rotate the given string to left or right in C?
I've been looking for a way to hash a given string in C# that
Algorithm to generate all possible letter combinations of given string down to 2 letters
How do I create an array in smarty from a given string like 22||33||50

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.