ListOfList = [ ['abcd',1], ['efgh',2], ['ijkl',3]]
print(ListOfList)

Let access list in list.
print('row 0', [row[0] for row in ListOfList] )
print('row 1', [row[1] for row in ListOfList] )

Very easy isn't it?
Enjoy~!
if 2 in [1, 2, 3]:
print('2 in list')
else:
print('2 in not list')
if 4 in [1, 2, 3]:
print('4 in list')
else:
print('4 in not list')
if (1,2) in [(1, 2) , (3, 2)]:
print('(1,2) in list')
else:
print('(1,2) in not list')
if 4 not in [1, 2, 3]:
print('4 not in list')
else:
print('4 in list')
if (1,2) not in [(1, 2), (3, 2)]:
print('(1,2) in not linst')
else:
print('(1,2) in list')
>>> t = [1, 2, 3, 1, 2, 5, 6, 7, 8]
>>> t
[1, 2, 3, 1, 2, 5, 6, 7, 8]
>>> list(set(t))
[1, 2, 3, 5, 6, 7, 8]
>>> s = [1, 2, 3]
>>> list(set(t) - set(s))
[8, 5, 6, 7]
>python manage.py makemigrations
>python manage.py migrate
>from webapp.models import Post
: db import
>Post.objects.all()
- first object
>Post.objects.all().first()
- last object
>Post.objects.all().last()
- 3rd object
>Post.objects.all()[2]
> obj = Post.objects.all()[2]
>obj.title = 'a_title_3'
>obj.save()
>>> from blog.models import Blog
>>> b = Blog(name='Beatles Blog', tagline='All the latest Beatles news.')
>>> b.save()
if table_name.objects.all().count() == 0:
print('none')
id = models.AutoField(primary_key=True)
visitor.objects.get(day_visiting=datetime.date.today())
or
visitor.objects.filter(day_visiting=datetime.date.today()).count()
today = datetime.date.today()
yesterday = today - datetime.timedelta(days = 1)
visitor.objects.get(day_visiting=today)
or
visitor.objects.filter(day_visiting=yesterday).count()