question about input() and/or raw_input()
Ethan Furman
ethan at stoneleaf.us
Sun Jan 19 14:16:12 EST 2014
On 01/19/2014 10:41 AM, Chris Angelico wrote:
> 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!
Argh. Yes, %x or %X.
--
~Ethan~
More information about the Python-list
mailing list