Disclaimer: I’m a Python newbie … if you know of a more efficient way let me know! I needed to take a sequence of 4 digits (eg 1145) and modify it to look like clock-time (eg “11:45″). After a bit of online (what else?) research I decided to take the approach of converting the integer [...]
Tag Archives: python
Python: removing repeated values in a list
Posted by admin on July 29, 2008
0 comments
PLAIN TEXT CODE: list = ['one', 'two', 'three', 'one', 'one', 'four', 'two'] #convert the list into a set. An element can only exist once within a set set = set(list) #convert the set back into a list type list = list(set) print list Are those variable names confusing? Let's look at that example again: PLAIN [...]
