Tag Filter - (Python)

Quickly comment out block of code in Python

While debugging a python module I needed to remove sections of code for quick functionality testing. For those not familiar with python the hash (#) character is used to comment out a single line of code, so how do you comment out a large block of code ?

Filed under: Notes  Tags: Python

Dynamic module loading with Python import

Lets say you don't know the module name before your program starts or your program needs to dynamically link to a module based on a specific version number. In other words you want a generic way of loading a module dynamically without initially knowing the name of the module before the program starts. This can be done easily in python with the following import syntax...

Filed under: Notes  Tags: Python
(default) 9 queries took 5 ms
NrQueryErrorAffectedNum. rowsTook (ms)
1DESCRIBE `posts`17171
2DESCRIBE `comments`11110
3DESCRIBE `tags`220
4DESCRIBE `categories`220
5DESCRIBE `posts_tags`220
6DESCRIBE `categories_posts`220
7SELECT Post.* FROM posts Post, posts_tags pt, tags t WHERE t.tag = ('Python') AND t.id = pt.tag_id AND pt.post_id = Post.id AND Post.status = 1 ORDER BY Post.created DESC222
8SELECT category, COUNT(*) AS cat_cnt FROM categories_posts c2p INNER JOIN categories Cat ON c2p.category_id = Cat.id GROUP BY category15151
9SELECT tag, COUNT(*) AS tag_cnt FROM posts_tags t2p INNER JOIN tags Tag ON t2p.tag_id = Tag.id GROUP BY tag49491