Saturday, 1 August 2015

Calculates mails for specific day

Calculate which day you received how many mails:-


 link for text file.

Source Code:-


#prompt to input a file

file  = raw_input("Enter a file name: ")

try:
    #try to open a file

    f_obj = open(file, 'r')

    #print 'yes'
except:
    #if file doesn't open error

    print 'can\'t open', file
    quit()

#define a dictionry named OUTPUT

output = dict()
#loop through the file for line one at time

for line in f_obj:
    line = line.lower()
    line = line.rstrip() #remove the white sapce from line's right end
    if line.startswith('from '):
        #print line

        words = line.split()
        #print words

        key = words[2]
        if key in output:
            output[key] += 1
        else:
            output[key] = 1

print output

Friday, 24 July 2015

Word count example

A small and simple program to count the words in a file and prints the top count.

Word count example

Sunday, 19 July 2015

Python examples

let's do some python examples. try your own logics and if find some new way please send me solution at mpsingh0001@gmail.com

Here is a link for examples:-

python basic examples

Python introduction and resources

Introduction:- 
Let's start learning python. A beautiful and easy programming language. it's a general purpose programming language i.e used in many fields like web, cloud, big data, IoT, back end and many others. Python lovers and others please support and develop the best software.

Resources to learn python which I followed:-
  1. JavaTpoint
  2. Tutorialspoint
  3. Python Official Docs
  4. Full Stack Python
  5. w3resource
and there are many more resources to learn python. it's a open source language download and start building your own programs.