DEV Community

Cover image for Python features you'll want to repeat
Vadim Kolobanov for Abstract

Posted on • Originally published at

Python features you'll want to repeat

File server on a computer with mobile access

You can access your file system by running a file server on your computer. Navigate to the desired directory that you want to access and run the following command:

# python version >=  3.X
python -m http.server
# python version >=  3.X
python3 -m http.server #for Linux

# If Python version >= 2.X and < 3.X
python -m SimpleHTTPServer
#default port: 8000

Enter fullscreen mode Exit fullscreen mode

This command starts a file server that can be accessed on the same network. To access your files on a mobile device, simply connect to the same network (Wi-Fi or use the phone's access point on a laptop). Now open the browser in your phone.


Enter fullscreen mode Exit fullscreen mode

Check your IP by running - ifconfig. Check your local IP

And on the mobile phone, you will see the current directory

Convert CSV to JSON 1 line

If you're a programmer, you'll probably be lazy and want to automate pretty much everything you can, right?

Don't worry, the python will cover you. There are a lot of things that you can automate in just 4-5 lines of code. From installing cron jobs and reminders to uploading your favorite YouTube videos, you can do it all with a few lines in python.

Example - convert CSV to JSON
You can convert a CSV file to JSON with just one command in Python!

python -c "import csv,json;print json.dumps(list(csv.reader(open('your_csv_file.csv'))))"
Enter fullscreen mode Exit fullscreen mode

Replace it with anyfile.csv and you will get JSON output!

Easy, right?


Yes, these are comics in python!

 import antigravity

Enter fullscreen mode Exit fullscreen mode


Will they add brackets in python?

from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance

Enter fullscreen mode Exit fullscreen mode

A simple life lesson

>>> import this
>>> love = this
>>> this is love
>>> love is True
>>> love is False
>>> love is not True or False
>>> love is not True or False; love is love  

Enter fullscreen mode Exit fullscreen mode

Put on Heart if you liked it and you learned something new!

You can also follow ME to receive notifications about new interesting articles.


I am a beginner, how should I learn Python?

Look into the following series:

Learning Python
Step by Step to Junior

Can we cooperate with you?

If you have interesting projects and you need a python (web)developer, then you can contact me by mail or discord and LinkedIn for cooperation

Connect to me on

Write me on Face....oh...Meta

My Twitter

Top comments (0)