[Tutor] Problem with input() and unicode string

Huy Ton That huyslogic at gmail.com
Wed Jul 28 19:16:23 CEST 2010


You can do:

input(unicode('Introduce el año:', 'latin-1').encode('latin-1'))

Maybe someone could explain it better than I can.

HTH,

Huy

On Wed, Jul 28, 2010 at 12:05 PM, Alex <abccbg at yahoo.co.uk> wrote:

> Hello, I have a problem with this code:
>
> # -*- coding: latin-1 -*-
> year = u'año, ò, ó, ç'
> print year
> year = input(u'Introduce el año:')
> print year
> raw_input()
>
> The first print statement works as expected, both in IDLE and when
> double-clicking the file for a console view.
> The second one works in IDLE, but just flashes by when double-clicking the
> file, due to an error report I can't see.
> I believe the problem is that input prompt doesn't support unicode strings,
> which means I can't use my language for prompts?
> Could someone please tell me how to fix it or provide a workaround?
> Thanx.
>
> Using Python 2.7 under win32.
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100728/bafcbd7a/attachment.html>


More information about the Tutor mailing list