Counting Letters in Python with Table [part 1.1 PrettyTable]

In the previous post, I had some technical problems, with the tags, and good step to rearrange the input and add Prettytable to the code, to create a better formatted table and thus better visualize the output of the program.

You can read in 2 Parts this entry according to the titles Python standard output and python with PrettyTables, I hope you enjoy it.

Python standard output

Counting letters is widely used in different branches of science, which is why it is of much interest today in Dia.

For example, we can usually see it in Cryptography or right now with the use of social networks in lexicology.

Lexicology is the study of a person's lexicon.

With data from Social Networks we can know how educated is an aspirant to work in our company, so be careful with what we write in social networks.

Although I wrote some loose entries in my Blog stickybitshell.wordpress.com about letters counters and words in plain text. As well as in Social Networks such as Twitter, today I told myself why not group these entries and give them more meanings for the formation of other interested people or just out of curiosity who want to see that they say their comments of them on Twitter or Facebook, Good here the first entry.

I'm not going to limit myself to Plain Text if not that my goal is to read PDFs because it makes great sense today to look for anything in a book

If that does google or grep on the Linux system but to entertain us and know how many words there are in a book and how many are "this" for example.

To begin with the beginning, we are going to enter a string of characters or phrase or simply copy this post and paste it in the console to later see the number of repetitions of the letters.

A I forgot if you have not installed Python that you are waiting, it is easy to work:

We can make a couple of improvements to show the most interesting output, such as create a table and show the letter and next to how many times it is repeated, then the output, for the next entry tomorrow I am upgraded. Here the output of the Program:

Using Python Dictionaries to count how many times a letter appears in a string, we could also create a program to count how many times a word appears or the concatenation of 2 words in a text.

For example this is done a lot in the Bible we could count how many times a Greek word appears in a Greek bible or any language, as I said at the beginning it is possible to know where a text is only by repeating the letters.

To finish the homework, which is the letter in Spanish that is repeated more times, take this line and find out.

Python with PrettyTables

In occasions we need to show data from python in a more elegant way and as everyone uses tables of calculations this is the most conventional way.

And well I chose Prettytables for its simplicity, but prettytables is better not to work directly with dictionaries, that's why in the code we first go to lists to make everything manageable.

The output is standard an unordered table, however in the next entry we are going to add the ordered table and some graphics that we will also use in other series with the Python Thanks theme...

H2
H3
H4
3 columns
2 columns
1 column
4 Comments