Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


More on LinuxToday


Another ten essential Python tips

Feb 16, 2010, 19:33 (0 Talkback[s])
(Other stories by Kunal Deo)

[ Thanks to Linux User & Developer magazine for this link. ]

"Python is one of the most popular programming languages in the open source space. Look around and you will find it running everywhere, from various configuration tools to XML parsing. To compliment our 'ten essential Python tips for beginners' and 'ten more essential Python tips' features, we've compiled yet another collection of ten gems to make your Python experience that much more worthwhile… Any bets on whether we'll do another?

"Converting any charset to UTF-8

"You can use the following function to convert any charset to UTF-8.

data.decode("input_charset_here").encode('utf-8')

"Removing duplicates from lists

"If you want to remove duplicates from a list, just put every element into a dict as a key (for example with 'none' as value) and then check dict.keys()."

Complete Story

Related Stories: