[Python-ideas] intput()

Andrew Barnert abarnert at yahoo.com
Mon Jan 25 17:24:44 EST 2016


    def binput():
        return bytes(map(ord, input()))

This should make Python 3-haters happy: it works perfectly, without any need for thought, as long as all of your friends are American. If not, just throw in random calls to .encode and .decode all over the place until the errors go away.

Sent from my iPhone

> On Jan 25, 2016, at 13:58, Ryan Gonzalez <rymg19 at gmail.com> wrote:
> 
> Also:
> 
> 
> def linput():
> 'Reads a list. Completely, 100% secure and bulletproof.'
> return map(eval, input[1:-1].split(',')))
> 
> 
> def ninput():
> 'Reads None.'
> assert input() == 'None'
> 
> def strinput():
> 'Reads a string. Also 100% secure.'
> return eval("'" + input() + "'")
> 
>> On January 25, 2016 2:04:08 PM CST, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>> Marcel O'Neil wrote:
>>>  def intput():
>>>      return int(input())
>> 
>> And also
>> 
>>    def flintput():
>>      return float(input())
>> 
>> Yabba-dabba-doo-ly,
>> Greg
>> 
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
> 
> -- 
> Sent from my Nexus 5 with K-9 Mail. Please excuse my brevity.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160125/54438ba2/attachment.html>


More information about the Python-ideas mailing list