python 2.7 - How can I convert a string representation of binary notation to actual binary notation -


so i've been playing around 20x4 character lcd display raspberry pi , python 2.7. i've been driving using rplcd library found here https://github.com/dbrgn/rplcd. in test_20x4.py source create custom characters using series of appears binary notations. example, create happy face character:

happy = (0b00000, 0b01010, 0b01010, 0b00000, 0b10001, 0b10001, 0b01110, 0b00000) 

this represents 8 rows, 5 column character. now, wrote gui son using tkinter , 1 of things want have user create own custom characters. have string representation of each 1 of series, example:

'0b00000' 

can convert binary notation?

>>> int('0b10101', 2) 21 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -