Re: How to only get \n for newline without the single quotes?

2018-02-24 Thread Ned Batchelder
On 2/24/18 2:08 PM, Peng Yu wrote: On Sat, Feb 24, 2018 at 12:45 PM, Wildman via Python-list wrote: On Sat, 24 Feb 2018 11:41:32 -0600, Peng Yu wrote: I would like to just get the escaped string without the single quotes. Is there a way to do so? Thanks. x='\n' print repr(x) '\n' Python 3

Re: How to only get \n for newline without the single quotes?

2018-02-24 Thread Peng Yu
On Sat, Feb 24, 2018 at 1:08 PM, Peng Yu wrote: > On Sat, Feb 24, 2018 at 12:45 PM, Wildman via Python-list > wrote: >> On Sat, 24 Feb 2018 11:41:32 -0600, Peng Yu wrote: >> >>> I would like to just get the escaped string without the single quotes. >>> Is there a way to do so? Thanks. >>> >>

Re: How to only get \n for newline without the single quotes?

2018-02-24 Thread Peng Yu
On Sat, Feb 24, 2018 at 12:45 PM, Wildman via Python-list wrote: > On Sat, 24 Feb 2018 11:41:32 -0600, Peng Yu wrote: > >> I would like to just get the escaped string without the single quotes. >> Is there a way to do so? Thanks. >> > x='\n' > print repr(x) >> '\n' > > Python 3.5.3 (defaul

Re: How to only get \n for newline without the single quotes?

2018-02-24 Thread Wildman via Python-list
On Sat, 24 Feb 2018 11:41:32 -0600, Peng Yu wrote: > I would like to just get the escaped string without the single quotes. > Is there a way to do so? Thanks. > x='\n' print repr(x) > '\n' Python 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118] on linux Type "help", "copyri

How to only get \n for newline without the single quotes?

2018-02-24 Thread Peng Yu
I would like to just get the escaped string without the single quotes. Is there a way to do so? Thanks. >>> x='\n' >>> print repr(x) '\n' -- Regards, Peng -- https://mail.python.org/mailman/listinfo/python-list

Re: read Unicode characters one by one in python2

2018-02-24 Thread Karsten Hilbert
On Sat, Feb 24, 2018 at 10:17:35AM -0600, Peng Yu wrote: > Here shows some code for reading Unicode characters one by one in > python2. Is it the best code for reading Unicode characters one by one > in python2? > > https://rosettacode.org/wiki/Read_a_file_character_by_character/UTF8#Python This

How to extract the raw bytes of the decoded unicode?

2018-02-24 Thread Peng Yu
Hi, I can extracted the encoded value as bytes. But is there a way to extracted the decoded value (for รก, it is C1)? Thanks. $ cat ./dumpunicode.py #!/usr/bin/env python3 while True: c = sys.stdin.read(1) if c: print(c) print('0x' + ''.join(['%x' % x for x in reversed(byt

SQLObject 3.6.0

2018-02-24 Thread Oleg Broytman
Hello! I'm pleased to announce version 3.6.0, the first stable release of branch 3.6 of SQLObject. What's new in SQLObject === Contributor for this release is Michael S. Root. Minor features -- * Close cursors after using to free resources immediately instead

read Unicode characters one by one in python2

2018-02-24 Thread Peng Yu
Here shows some code for reading Unicode characters one by one in python2. Is it the best code for reading Unicode characters one by one in python2? https://rosettacode.org/wiki/Read_a_file_character_by_character/UTF8#Python -- Regards, Peng -- https://mail.python.org/mailman/listinfo/python-li

Re: How to make Python run as fast (or faster) than Julia

2018-02-24 Thread bartc
On 24/02/2018 02:05, Steven D'Aprano wrote: On Fri, 23 Feb 2018 19:25:35 +, bartc wrote: Python is 10 times slower than a competitor = doesn't matter My language is 1.5 times slower than the big boys' = matters a great deal As for Python's order-of-magnitude speed difference, thank you

Re: How to make Python run as fast (or faster) than Julia

2018-02-24 Thread bartc
On 24/02/2018 02:46, Steven D'Aprano wrote: Take the Fibonacci double-recursion benchmark. Okay, it tests how well your language does at making millions of function calls. Why? How often do you make millions of function calls? Very often. Unless you are writing code 1970s style with everything