On 07Dec2018 21:20, Steven D'Aprano wrote:
On Fri, Dec 07, 2018 at 02:06:16PM +0530, Sunil Tech wrote:
I am using Python 2.7.8
That is important information.
Python 2 unfortunately predates Unicode, and when it was added some bad
decisions were made. For example, we can write this in Python
On Sun, Dec 09, 2018 at 09:23:59AM +1100, Cameron Simpson wrote:
> On 07Dec2018 21:20, Steven D'Aprano wrote:
# Python 2
> txt = "abcπ"
> >
> >but it is a lie, because what we get isn't the string we typed, but the
> >interpreters *bad guess* that we actually meant this:
> >
> txt
> >'ab
This is not a request for help, but a demonstration of what can go wrong
with text processing in Python 2.
Following up on the "Special characters" thread, one of the design flaws
of Python 2 is that byte strings and text strings offer BOTH decode and
encode methods, even though only one is mea