top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Write a python script to create a infinite loop using for ?

+1 vote
661 views
Write a python script to create a infinite loop using for ?
posted Feb 5, 2015 by Gnanendra Reddy

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Try something like following

while True: 
    print 'QueryHome'

for x in iter(int, 1):
    print 'QueryHome'
answer Feb 5, 2015 by Salil Agrawal
what is iter(int,1)?
These are two method anyone you can choose to achieve the infinite loop. Documentation of built-in functions can be found at https://docs.python.org/2/library/functions.html
Similar Questions
0 votes

I'm trying to write a python script that writes some content to a file root through sudo, but it's not working at all. I am using:

 channel = 'stable'
 config_file = '/opt/ldg/etc/channel.conf'
 command = ['echo', '-n', channel, '|', 'sudo', 'tee', config_file]
 p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 out, _ = p.communicate()

But it seems as if this isn't doing anything.

I just want to write the contents of the variable channel to the file /opt/ldg/etc/channel.conf. But whatever I try just doesn't work. Can anyone offer any pointers?

+1 vote

i want to create a chrome extension. its have complex mathematical queries. so i need to use python as scripting language. help me to implement python script in google chrome addon

+1 vote

I am Automating some repetitive works through Sikuli and Python scripting languages. I have multiple workflows. I need to schedule this script for every two hours. Can anyone guide me how to schedule the scripts for every two hours.

Is there any way to schedule the python programming through Task scheduler in windows platform.

My environment
OS:Windows
Programming languages: Sikuli,Python

0 votes

How can write a python script which will execute some perl scripts in a gui and shouldn't be post processed....?

...