Bottom Page

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 octal encoding
#1
is the explicit octal sequence encoding supposed to be available or not in string literals?
Output:
lt1/forums /home/forums 1> ; bash: syntax error near unexpected token `;' lt1/forums /home/forums 2> py2 Python 2.7.12 (default, Nov 20 2017, 18:23:56) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> len('\x07') 1 >>> len('\o007') 5 >>> lt1/forums /home/forums 3> py3 Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> len('\x07') 1 >>> len('\o007') 5 >>> lt1/forums /home/forums 4>
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote
#2
'\007'
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Quote
#3
b'\377' == b'\xff' and int('0o377', 8) == 0o377 == 0xff == 255
My code examples are always for Python >=3.6.0
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Quote
#4
Python 3.6.3 (default, Oct 24 2017, 14:48:20)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> len('\007')
1
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Quote
#5
(Dec-04-2017, 09:43 AM)wavic Wrote: '\007'

that's the implicit one.  i'm asking about the explicit one where you specify that it is octal.  and i am asking about what string literals accept, not numeric literals.

i thought string literals would accept explicit octal sequences so i included them in my conversion function.  i guess i am wrong.  i was too confident to RTFM or just test it myself.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  regex octal replace chaz_sliger 1 1,135 Sep-06-2018, 01:21 AM
Last Post: scidam
  octal instead of hex Skaperen 4 1,845 Jun-06-2017, 02:00 AM
Last Post: Skaperen

Forum Jump:


Users browsing this thread: 1 Guest(s)