[x[0].decode("UTF-8").encode("Windows-1251") for x in [(u'123',),(u'dadasd',),(u'hello seal',),(u'hello seal',),(u'seal',)]]
list0 = [(u'123',),(u'dadasd',),(u'hello seal',),(u'hello seal',),(u'seal',)]
list0 = [x[0].decode("UTF-8").encode("Windows-1251") for x in list0]
list0 = ", ".join(list0)
>>> import itertools
>>> print(list(itertools.ifilter(lambda x:x%2==0,[2,4,6,7,9,8])))
[2, 4, 6, 8]
>>> print(list(itertools.ifilterfalse(lambda x:x%2,[2,4,6,7,9,8])))
[2, 4, 6, 8]
def connect():
""" Connect to MySQL database """
try:
conn = mysql.connector.connect(host='localhost',
database='mydb',
user='root',
password='')
if conn.is_connected():
print('connection established.')
else:
print('connection failed.')
return conn
except Error as e:
print(e)
finally:
conn.close()
u"blabla".decode("UTF-8").encode("CP866")
buildgraph(getarray1(), getarray3(getarray1(), getarray2()))
array3 = getarray3(getarray1(), getarray2())
buildgraph(getarray1(), array3)
array1 = getarray1()
array2 = getarray2()
array3 = getarray3(array1, array2)
buildgraph(array1, array3)