How to force a single number to be a tuple

Jinming Xu cybermanxu at hotmail.com
Wed Aug 4 15:42:34 EDT 2004


Graeme,

I found that too. I asked really a stupid question. Shame on me! :(

Thanks anyway,

Jinming


>From: "Graeme Longman" <graeme.longman at tangozebra.com>
>To: "Jinming Xu" <cybermanxu at hotmail.com>, <python-list at python.org>
>Subject: RE: How to force a single number to be a tuple
>Date: Wed, 4 Aug 2004 17:29:18 +0100
>
>Hi,
>
>Couldn't you say:
>
> >>> y = 2,
> >>> y
>(2,)
>
>Cheers.
>Graeme
>
> > -----Original Message-----
> > From: python-list-bounces+graeme.longman=tangozebra.com at python.org
> > [mailto:python-list-bounces+graeme.longman=tangozebra.com at python.org]On
> > Behalf Of Jinming Xu
> > Sent: 04 August 2004 17:26
> > To: python-list at python.org
> > Subject: How to force a single number to be a tuple
> >
> >
> > Hi Folks,
> >
> > I have a number sequence, which is put into a tuple like this:
> >
> > y=2, 3.0, 4.5
> >
> > I can manipulate the sequence as a tuple when it has more than 1
> > number. But
> > when the sequence has only 1 number, like
> >
> > y=2
> >
> > I have trouble to manipulate it as a tuple.  I guess there must
> > be a way to
> > forece a single number to be a tuple. Could anyone please tell me that?
> >
> > Thanks,
> >
> > Jinming
> >
> > _________________________________________________________________
> > FREE pop-up blocking with the new MSN Toolbar – get it now!
> > http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
> > ________________________________________________________________________
> > This e-mail has been scanned for all viruses by Star Internet. The
> > service is powered by MessageLabs. For more information on a proactive
> > anti-virus service working around the clock, around the globe, visit:
> > http://www.star.net.uk
> > ________________________________________________________________________
> > ---
> > Incoming mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.732 / Virus Database: 486 - Release Date: 29/07/2004
> >
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.732 / Virus Database: 486 - Release Date: 29/07/2004
>
>
>________________________________________________________________________
>This e-mail has been scanned for all viruses by Star Internet. The
>service is powered by MessageLabs. For more information on a proactive
>anti-virus service working around the clock, around the globe, visit:
>http://www.star.net.uk
>________________________________________________________________________

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




More information about the Python-list mailing list