Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19700
| References | <1328057052.56088.YahooMailNeo@web30601.mail.mud.yahoo.com> <CAOv69sb2e0Aj-v5zM8iczPt2DAGtFZHmHgZBWPdCqnLfre0+dw@mail.gmail.com> <1328058665.56641.YahooMailNeo@web30607.mail.mud.yahoo.com> |
|---|---|
| Date | 2012-02-01 20:48 +1100 |
| Subject | Re: How can I verify if the content of a variable is a list or a string? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5293.1328089733.27778.python-list@python.org> (permalink) |
On Wed, Feb 1, 2012 at 12:11 PM, Andres Soto <soto_andres@yahoo.com> wrote:
>
> okok, my mistake is that I was using string in place of str. Thank you!!
> regards
Tip: In the interactive interpreter, enter:
>>> type("spam")
<class 'str'>
In Python 2, it'll say "type" not "class", but same diff. It tells you
there what the type is.
Same can be used for any other literal, name, or other object. Can be
quite handy at times.
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How can I verify if the content of a variable is a list or a string? Chris Angelico <rosuav@gmail.com> - 2012-02-01 20:48 +1100
csiph-web