Posts

Why Pay when education is free !

Why Pay when education is free ! Share on LinkedIn Share on Facebook Share on Twitter Why pay for education when it is free.. here is my list of sites that can be used for getting free training. Courses range from IT to Arts... there are some courses which give certificate of completion but have a fees attached. Good part is that they are recognized by many organizations when hiring. So pick a topic of your interest and start learning something new today : https://www.udacity.com   -  IT skills related courses https://www.khanacademy.org/  - Everyday topic on Maths, Science, Arts.. https://www.coursera.org/  - Non IT skills like Arts, Humanities, Admin etc.  https://www.edx.org/  - Courses on anything and everything https://alison.com/  - Diploma and other courses on Non IT skills Then comes the MOOC folks. Here is a short list http://online-learning.harvard.edu/courses  - Harvard http://online.stanford.edu/courses  ...

How to run all scripts in a directory on Linux

How to run all scripts in a directory on Linux Posted on   November 5, 2013   by   Dan Nanni 2 Comments Question:   I have a bunch of scripts in a directory. I want to automatically run all the scripts in the directory, regardless of how many these are. If you want to   run all scripts or executable binaries in a particular directory , you can use a command line utility called   run-parts . This tool can automatically discover multiple scripts or programs in a directory, and run them all. You can use   run-parts   command in the following format. $ run-parts [options] Scripts found in a directory will be run one by one in a lexically sorted order.   run-parts   will execute all the scripts whose names consist of alphanumeric letters, underscores and hyphens. For example, to run all scripts in the current directory: $ run-parts . Optionally, you can run only those scripts whose names are matched with a regular expres...

python: readline() and read()

[root@mysql Scripts]# ./file1.py If we give print han1 Then output would be File is open only once Actual output should be like this so use han1.readline() [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] If you use han1.readline(10) Then it will print next 10 characters as in upper line already pritn upto first   I am a bes If you use again han1.readline(10) then it will print next 10 character untill didnt get next line t player If you use han1.readline(15) then again print next 15 characters  I am the best p ------------------now start read()-------------------- Now use han1.read() layer I am  best player I am an best player I am a best player I am a best player I am a best player I am a best player I am a best player I am a best player This will print only Blank lines han1.read(20)....  because file completly open by last command now nothing to read in file so only blank spaces...:)

Python: Open file example 1

#!/usr/bin/python han1 = open("davinder.txt","r") print "\n\n" print "If we give print han1 Then output would be", han1, "\n\n" print "File is open only once" print "Actual output should be like this so use han1.readline()", han1.readline(),"\n" print "If you use han1.readline(10) Then it will print next 10 characters as in upper line already pritn upto first \n ", han1.readline(10) print "If you use again han1.readline(10) then it will print next 10 character untill didnt get next line", han1.readline(10) print "If you use han1.readline(15) then again print next 15 characters ", han1.readline(15) print "------------------now start read()--------------------" print "Now use han1.read()", han1.read() Output: [root@mysql Scripts]# ./file1.py If we give print han1 Then output would be File is open only once Actual output should be like this so use han1.read...

Python: Simple for loop

#!/usr/bin/python import sys c = "I am a best player" a = range(1,11) print a for b in a:         print  c OUTPUT: [root@mysql Scripts]# python For.py [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] I am a best player I am a best player I am a best player I am a best player I am a best player I am a best player I am a best player I am a best player I am a best player I am a best player  

python: Print the table of enter value

#!/usr/bin/python import sys c = input("What Table you want to learn ") print "you have entered table of ",c a = range(1,11) print a for b in a:         print  c,"*",b,"=", b * c Output:  [root@mysql Scripts]# python for.py What Table you want to learn 4 you have entered table of  4 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 4 * 1 = 4 4 * 2 = 8 4 * 3 = 12 4 * 4 = 16 4 * 5 = 20 4 * 6 = 24 4 * 7 = 28 4 * 8 = 32 4 * 9 = 36 4 * 10 = 40 [root@mysql Scripts]# python for.py What Table you want to learn 6 you have entered table of  6 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 6 * 1 = 6 6 * 2 = 12 6 * 3 = 18 6 * 4 = 24 6 * 5 = 30 6 * 6 = 36 6 * 7 = 42 6 * 8 = 48 6 * 9 = 54 6 * 10 = 60

IF and elif and else

#!/usr/bin/python import sys # By default argument will count script name also so I have reduced -1 for exact value arg_count = len(sys.argv) - 1 #print what I have entered in arguments" print "\nYou have entered ",arg_count, "arguments", sys.argv[1],",", sys.argv[2] # Store Argurments in variable Arg_first = sys.argv[1] print "\nType of first argument is ", type(Arg_first) # store second arg in variable Arg_Sec  =  sys.argv[2] print "\nType of second argument is", type(Arg_Sec) #By default argement will be in string type so converting in integer for mathematical a = int(Arg_first) print "\nAfter converting argument type is", type(a) b = int(Arg_Sec) print "After converting second argument type is", type(b) if a == b:         print "\nAddition of Argument 1 and Argument 2 is", a + b elif a < b:         print "\nMultiple of Arg1 and Arg2 is", a * b elif a > b:       ...