Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84005 > unrolled thread
| Started by | contro opinion <contropinion@gmail.com> |
|---|---|
| First post | 2015-01-19 17:01 +0800 |
| Last post | 2015-01-19 17:01 +0800 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
How to change the number into the same expression's string and vice versa? contro opinion <contropinion@gmail.com> - 2015-01-19 17:01 +0800
| From | contro opinion <contropinion@gmail.com> |
|---|---|
| Date | 2015-01-19 17:01 +0800 |
| Subject | How to change the number into the same expression's string and vice versa? |
| Message-ID | <mailman.17845.1421658099.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
In the python3 console:
>>> a=18
>>> b='18'
>>> str(a) == b
True
>>> int(b) == a
True
Now how to change a1,a2,a3 into b1,b2,b3 and vice versa?
a1=0xf4
a2=0o36
a3=011
b1='0xf4'
b2='0o36'
b3='011'
Back to top | Article view | comp.lang.python
csiph-web