python
Python: converting a string representing an hexadecimal integer representation into an int variable
Recently I had the need to convert a string containing the hexadecimal representation of an integer into an integer variable.
Eg, with something like FFAA, create an integer variable with the value of 65450.
In some programming languages there is an unhex() function but not in python.
In order to do so you'll need to use int(). If called with two arguments, int() expects the first to be a string representing a number in some base and the second to be the base.
Capturing a screen image with python and PIL on Windows
The more I use Python, the more I love it.
This programming language is simply awesome: with it's simple api and the huge amount of freely available additional modules creating complex applications is really easy and fast.
For example less than 15 minutes ago I wondered: how can I capture an image of the computer screen using Python?
If you don't know Python you might think that this could be pretty a complex task.
A simple django basename template filter tag
I'm using Django, a python coded framework to develop web applications, to implement a project for the University.
During the development I needed to have a template tag which, given a path to a file, just returns its basename (just as it do the python os.path.basename).
So I implemented it. Following you have the code for it.
Python: call a function with more arguments on each element of a list
I'm recently working a lot with Python because I understood it perfectly fits my needs being powerful, clean and fast to develop with it.
If you program with it there are good chances that you will end up using lot of lists which are pretty well designed and powerful in Python.
A really useful function in Python is map() which let you execute one function on each element of a list:
L = [0.1, 0.4, 0.7] L2 = map(round, L) print L2 #output [0.0, 0.0, 1.0]
Serial RS232 connections in Python
Here at ULPGC I'm following a Robotics course. In the practical part of the exam we have to write some applications to operating some didactics robots we have (Rhino XR-4 and SCARA Robots).
Each robot is connected to a Controller (Rhino Mark-4) which can be connected to a PC to send commands to the Controller in order to let the robots do things.
The PC to Controller connection is a serial RS-232 connection.
Sudoku resolver in Python
A simple Sudoku resolver written in Python.
Sorry for the Italian code comments. Please add a comment below if you don't get parts of the algorithm.



Recent comments
1 day 6 hours ago
1 day 6 hours ago
3 days 3 hours ago
3 days 3 hours ago
3 days 21 hours ago
5 days 20 hours ago
5 days 20 hours ago
1 week 2 days ago
1 week 3 days ago
1 week 3 days ago