s = r'\u0410 \u0443 \u043c\u0435\u043d\u044f \u0449\u0430\u0441 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435 \u0447\u043c\u043e \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0434 \u043e\u043a\u043d\u0430\u043c\u0438!'
print(s.encode('ascii').decode('unicode_escape'))
А у меня щас вот такое чмо стоит под окнами!
sys.path.append('D:\\Tasks_Python\\My_modules')
rgb = np.zeros(3)
for i in range(1, width - 1):
for j in range(1, height - 1):
for k in range(3):
current_matrix = pix[i-1:i+2, j-1:j+2, k]
rgb[k] = draw_effects_functions.change_color_effects(l, current_matrix, matrix_type_dict)
draw.point((i, j), rgb)
def resource_path(relative):
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative)
else:
return os.path.join(os.path.abspath("."), relative)
self.setWindowIcon(QtGui.QIcon(resource_path('file.ico')))
self.tray_icon.setIcon(QtGui.QIcon(resource_path('file.ico')))
a = Analysis(['xxx.pyw'],
pathex=['.'],
binaries=[('file.ico', '.')],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
coding=utf-8
import numpy as np
x, y, z = 2, 4, 8
a = np.arange(x * y * z).reshape(x, y, z)
b = np.concatenate([a[i] for i in range(a.shape[0])], axis=1) # <- solution
c = np.array([[0, 1, 2, 3, 4, 5, 6, 7, 32, 33, 34, 35, 36, 37, 38, 39],
[8, 9, 10, 11, 12, 13, 14, 15, 40, 41, 42, 43, 44, 45, 46, 47],
[16, 17, 18, 19, 20, 21, 22, 23, 48, 49, 50, 51, 52, 53, 54, 55],
[24, 25, 26, 27, 28, 29, 30, 31, 56, 57, 58, 59, 60, 61, 62, 63]])
print('\n', a)
print('\n', b)
print('\n', c)
print('\n', np.array_equal(b, c))
if event.key() == Qt.Key_0 or Qt.Key_1:
if event.key() in [Qt.Key_0, Qt.Key_1]:
key = event.key()
if key == Qt.Key_0 or key == Qt.Key_1:
# -*- coding: utf-8 -*-
def print_result(func):
def wrapper(*args, **kwargs):
rc = func(*args, **kwargs)
print('function ' + func.__name__ + ' returns ' + repr(rc))
return rc
return wrapper
@print_result
def a(x=0):
return x, x*x
print('a(2) =', a(2))
# -*- coding: utf-8 -*-
import os
import subprocess
import tempfile
fhandle, fname = tempfile.mkstemp(suffix='.txt', dir='.')
try:
with os.fdopen(fhandle, mode='w') as file:
file.write('Hello world!')
file.flush()
os.fsync(file.fileno())
subprocess.call(['notepad', fname])
finally:
os.remove(fname)