In Python and Windows environment how to supress certain key press and send some other key event for it

2017-04-02 Thread Krishnan Shankar
Hi All, I was trying to build a VIM like shortcuts in windows. For example, IF i press CAPSLOCK & h: It should "{Left}" move one to left. If CAPSLOCK & b: It should "{Ctrl Down}{Left}{Ctrl Up}" move one word left etc. I was successful in sending the key event. I used libraries like, 1. pynput 2

Re: Reading csv file

2013-12-16 Thread Krishnan Shankar
Hi Igor You can use the following way to do this using "with" operator. def Read_CSV_File(filename): with open(filename, "r") as csvfile: csvreader = csv.DictReader(csvfile) line = 1 for row in csvreader: if line < 6: reader.next(

Accessing the Taskbar icons

2013-11-07 Thread Krishnan Shankar
Hi All, I am automating an application in windows using python. After installation i need to check if the applications icon has appeared in Taskbar or not. If yes i need to right click the application. I had been using pywinauto for the same but could not get the job done till now. I did the fo

Doubt on generators behavior

2013-10-13 Thread Krishnan Shankar
Hi Friends, I am new to Generators and was learning the same by experimenting. I wrote a small code which is as below. >>> def test_gen(var): ... print "The number is", var ... if var % 2 == 0: ... yield var ... else: ... print "Number is odd" ... >>> But when i was e

Re: TypeError: 'int' object is not callable

2013-08-26 Thread Krishnan Shankar
Hi, The problem is in the second line. a = time.daylight() The daylight is not a method in time module. It is clear here, http://docs.python.org/2/library/time.html Since it is not a method we cannot call it. It is just a integer variable . It returns zero if DST timezone is not defined and ret

List getting extended when assigned to itself

2013-08-24 Thread Krishnan Shankar
Hi Python Friends, I came across an example which is as below, >>> var = [1, 12, 123, 1234] >>> var [1, 12, 123, 1234] >>> var[:0] [] >>> var[:0] = var >>> var [1, 12, 123, 1234, 1, 12, 123, 1234] >>> Here in var[:0] = var we are assigning an entire list to the beginning of itself. So shouldn't

Re: Verifying Variable value

2013-08-14 Thread Krishnan Shankar
You can even use logging module in python to validate the variable values. You can import the module and use any of the following levels in your program import logging logging.CRITICAL, logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG For more you can refer to, http://docs.python.or

Re: Verifying Variable value

2013-08-14 Thread Krishnan Shankar
Hi Chandan, Python has built-in module called pdb which can be used for debugging. Importing it in the right place will be like setting break point in code and will change the execution to debugging mode. We can use different debugging commands ((n)ext, (c)ontinue, (s)tep etc) to evaluate through

Re: .split() Qeustion

2013-08-13 Thread Krishnan Shankar
Hi, >How can I use the '.split()' method (am I right in calling it a method?) The .split() is a method in Python which comes as in built method for String objects in Python. Any string defined in python will have the ability to call this function. >>> var = 'Hello how r u?' >>> dir(var) ['__add_

Introduction to my fellow Python Friends

2013-08-11 Thread Krishnan Shankar
Hi Friends, I would like to introduce myself. I am Krishnan from Chennai, India. I am using python for 2 years for Test Automation. I am fascinated by the language and its capabilities. I am willing to move into Python development and I am doing the best i can to learn the language completely and

Re: Python Basic Doubt

2013-08-10 Thread Krishnan Shankar
#x27; Because i recommended this should not be done. But my colleagues say it is correct. Regards, Krishnan On Sat, Aug 10, 2013 at 10:10 PM, Tim Chase wrote: > On 2013-08-10 21:03, Krishnan Shankar wrote: > > >>> a=10 > > >>> id(a) > > 21665504 > > &g

Python Basic Doubt

2013-08-10 Thread Krishnan Shankar
Hi Fellow Python Friends, I am new to Python and recently subscribed to the mailing list.I have a doubt regarding the basics of Python. Please help me in understanding the below concept. So doubt is on variables and their contained value. Why does in the below example from Interpreter exploratio