How to programm in Python on your phone or android tablet

For Fanny!

First you will need to install Termux.
In Termux you run the following:

First if you haven't already, make it possible to access the phone drive from termux. This is optional.

ls storage
ls storage/shared

If you run those three commands, you will see the contents of your android phone. The folders in showing up in the second commands are shortcuts. The folders under storage/shared is the topmost directory on your phone.

Install python and update pip:

pkg install python   
pip install -U pip

You can now get into python by typing python.

Some pip packages might not work, in that case you might need to install a library, for instance libxml

pkg install libxml2 libxslt      
pip install lxml

You will probably want a text editor on your phone. You can either run one inside linux on termux or you use an android app and select the folder and file in the app. For blog posts, I use iA Writer, but there are editors like ACode which look promising. Consider using micro, nano, emacs or vim because you can use them on all other systems too.

Learning python on your phone

I recommend the free book automate the boring stuff with python!
It has a chapter on excel sheet automation, which should also work on android phones!

Thanks to: