Python SimpleHTTPServer

python-simplehttpserver

Python’s SimpleHTTPServer is very lightweight and very useful. If you want to share files from your localhost or if you want a quick web server without messing with setting up apache or something similar SimpleHTTPServer is here for you. All you

Read More Python SimpleHTTPServer

Python – Difference Between “is” and “==” (double equals)

Python - Difference Between is and double equals

This may be a point where a lot of you may get confused. I see some people using them in if conditions without actually knowing what they do. Let me try to explain the concept with a couple of lines of

Read More Python – Difference Between “is” and “==” (double equals)

Python – Difference between “.append()” and “+= []”

In my new Django project, I was trying to append a list of tuples (which contained more than 1 tuple in it) into another list of tuples. Then I got this error: ValueError: too many values to unpack (expected 2) I

Read More Python – Difference between “.append()” and “+= []”

Django Error – django.db.utils.OperationalError: no such table

django-no-such-table

Django “no such table” error of death.. I recently encountered this “no such table” error while trying to run makemigrations command on PyCharm. I dropped database tables related to my app, cleaned django_migrations table for this app, cleared migrations folder as

Read More Django Error – django.db.utils.OperationalError: no such table

Python – Single Line For Loops (List Comprehensions)

django-list-comprehensions

In Python there is a very simple and elegant way of defining a for loop in a single line. Thing is, not only can you define this for loop but you can also use the values in this loop to

Read More Python – Single Line For Loops (List Comprehensions)