Writing

--Originally published at Coding with jared

There´s another way to write down notes without using Word, LibreOffice, Notepad or any other famous text editors…..

Resultado de imagen para libreoffice writer

Resultado de imagen para wordResultado de imagen para no more

You can now create your very own text files with Python3, and it is pretty easy, you may only need a command o do it which is .write(“Whatever You Want”)

You may also wanto to create a .txt file, so in order to do this we need to make a variable

You need the command open(), and inside the parentheses you can name your file, but it has to end with .txt, then you use a comma , parentheses and “w”, the w means that you are able to write on that file.

screenshot-from-2016-11-23-19-58-21

You may run this code on the terminal , but the terminal won´t show anything, but the file will be created, here appears mine on my desktop.

screenshot-from-2016-11-23-20-02-21

 

Now to write on the new file you need to write the name of the variable plus .write(), and inside the parentheses between brackets you write whaterver you want.

screenshot-from-2016-11-23-20-03-17

Be sure to save the file and run it again on the terminal, once again it will show nothing on it…

screenshot-from-2016-11-23-20-04-03

 

but if you double click your .txt file. the text you wrote on python will appear on the text editor.

screenshot-from-2016-11-23-20-04-47

?

I learned to create and modify text files from this video:

 

Cheers to Computer Science UK for making great videos.