Python Base64 encode decode

import base64                                                       

a = base64.b64encode(bytes(u’complex string: ñáéíóúÑ’, «utf-8»))

# a: b’Y29tcGxleCBzdHJpbmc6IMOxw6HDqcOtw7PDusOR’

b = base64.b64decode(a).decode(«utf-8», «ignore»)                   

print(b)

# b :complex string: ñáéíóúÑ

Python подключение к базе данных MSSQL

import pyodbc
cnxn = pyodbc.connect("Driver={SQL Server};"
                      "Server=srvmssql;"
                      "Database=mydatabase;"
                      "Trusted_Connection=yes;")
cursor = cnxn.cursor()
cursor.execute('SELECT TOP 10 * FROM MYTABLE')
for row in cursor:
    print('row = %r' % (row,))
input()