I ran the 2to3 tool on various scripts that I wrote to get an idea of ββwhat I would need to change in order to port them to Python 3 (although I will do it manually at the end).
In doing so, I came across an odd 2to3 change made in one of my scripts:
-def open_pipe(pipe, perms=0644): +def open_pipe(pipe, perms=0o644):
Um ... Why did 2to3 add an "o" in the middle of my "perms" integer?
This line 41 from the original source is found here: https://github.com/ksoviero/Public/blob/master/tempus.py
0644 python2. , octal. python3 0o octal.
0644
octal
0o
python2:
python2
>>> 0644 420 >>>
python3:
python3
>>> 0644 File "<stdin>", line 1 0644 ^ SyntaxError: invalid token >>> 0o644 420 >>>
0720; 0o720.
Python 3.0 - :
0720
0o720
0 Python 3. , 0o:
0
$ python Python 2.7.3 (default, Dec 18 2012, 13:50:09) >>> 0644 420 >>> $ python3 Python 3.2.3 (default, Jul 23 2012, 16:48:24) >>> 0644 File "<stdin>", line 1 0644 ^ SyntaxError: invalid token >>> 0o644 420
, :
Source: https://habr.com/ru/post/1544348/More articles:Constructor leak - c ++Exception thrown in the constructor: is the destructor called? - c ++cx_freeze with docx package - pythonpython is not recognized in Windows CMD even after being added to PATH - pythonIs there a way to prevent the kendo datepicker popup from appearing when I click on a known container that is outside the datepicker? - javascriptHow to create a user in Postgresql? - postgresqlHow to increase the number of ticks when using the logarithmic scale in gnuplot - gnuplotHow to listen to UIReturnKeyType.Next with Swift iOS - iosComparison of "T extends Number" for equality - javaproductbuild: add a third-party product archive to the installer? - xcodeAll Articles