On Sat, Feb 11, 2017 at 11:10 AM, Alex Kleider <aklei...@sonic.net> wrote: > On 2017-02-11 00:36, eryk sun wrote: >>
>> Note that Python 3 uses the Unicode database to determine the decimal >> value of characters, if any. It's not limited to the ASCII decimal >> digits 0-9. For example: >> >> >>> s >> '௧꘢୩' >> >>> int(s) >> 123 >> >>> print(*(unicodedata.name(c) for c in s), sep='\n') >> TAMIL DIGIT ONE >> VAI DIGIT TWO >> ORIYA DIGIT THREE > > > ??? > alex@X301n3:~$ python3 > Python 3.4.3 (default, Nov 17 2016, 01:11:57) > [GCC 4.8.4] on linux > Type "help", "copyright", "credits" or "license" for more information. >>>> >>>> s > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > NameError: name 's' is not defined > What your 's' represents seems quite different to 'mine.' > There must be something else going on. I suspect Eryk had set a normal 's' as an identifier for the character code sequence that produces the non-ASCII output, but forgot to show us that step. But I could be mistaken. Today I am working in Windows 7, not Linux Mint. Of course when I attempted to copy and paste the non-ASCII sequence from Gmail into cmd.exe I got 3 rectangular boxes on the paste line, indicating cmd.exe could not translate those characters. However, if I paste them into IDLE or gvim, things are translated correctly: Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> s Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> s NameError: name 's' is not defined >>> '௧꘢୩' '௧꘢୩' >>> I think that this demonstrates that 's' is just an identifier pointing to the non-ASCII character sequence, but that the actual characters can be copied and pasted *if* the editor or environment you paste those characters into is setup to translate those characters. boB _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor