Use
#set #python #duplicate #unique
set
on a list to remove duplicates:my_dup_list = [1,2,3,4,1,2,3,4]
print set(my_dup_list)
#set #python #duplicate #unique
More about
If you want to set a variable named
If you want to include a partial template (child template) into your parent template use
If one of your templates inherits from a main layout use
#python #jinja2 #extends #include #set #variable #set_variable #layout
jinja2
:If you want to set a variable named
button
:{% set button = 'Login' %}
If you want to include a partial template (child template) into your parent template use
include
:{% include 'fa.button.tpl' %}
BE CAREFUL
that we have used {%
NOT {{
for the code block.If one of your templates inherits from a main layout use
extends
directive:{% extends "layout.tpl" %}
#python #jinja2 #extends #include #set #variable #set_variable #layout
When you use
the set. For that use the below python package:
#python #set #ordered_set #orderedset
set
in Python it makes sure that your list is unique, but does not keep the insertion order ofthe set. For that use the below python package:
https://pypi.python.org/pypi/orderedset
NOTE:
becareful if you want to use it in production as it is 5 times slower than set!#python #set #ordered_set #orderedset
How to disable visual block in
There is a feature in vim that as you select a text inside of vim, it turns the mode into
#vim #visual_block #mouse #set #vimrc
VIM
?There is a feature in vim that as you select a text inside of vim, it turns the mode into
VISUAL BLOCK
. This is annoying for me in case you want to disable it put the below code in ~/.vimrc
:set mouse-=a
#vim #visual_block #mouse #set #vimrc
https://hackernoon.com/python-3-7s-new-builtin-breakpoint-a-quick-tour-4f1aebc444c
#python #python37 #breakpoint #pdb #set_trace
#python #python37 #breakpoint #pdb #set_trace
Hackernoon
Python 3.7’s new builtin breakpoint — a quick tour | HackerNoon
Debugging in Python has always felt a bit “awkward” compared with other languages I’ve worked in.