question about input() and/or raw_input()

Chris Angelico rosuav at gmail.com
Sun Jan 19 13:41:34 EST 2014


On Mon, Jan 20, 2014 at 4:50 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
> The difference I was thinking of is:
>
>   "%h" % 3.14  # this works
>
> vs.
>
>   hex(3.14)  # this raises
>
> In 3.5 both will raise.

Now you have me *thoroughly* intrigued. It's not %h (incomplete format
- h is a modifier), nor %H (unsupported format character). Do you mean
%x? As of 3.4.0b2, that happily truncates a float:

>>> "%x" % 3.14
'3'

Is that changing in 3.5? Seems a relatively insignificant point, tbh!
Anyway, no biggie.

ChrisA



More information about the Python-list mailing list