Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python do something while waiting for input

from threading import Thread
from time import sleep

result = None

def update_every_second():
    while result is None:
        sleep(1)
        print "update"

t = Thread(target=update_every_second)
t.start()
result = raw_input('? ')

print "The user typed", result
Comment

PREVIOUS NEXT
Code Example
Python :: transpose list 
Python :: fibonacci sequence in python 
Python :: python try and except 
Python :: django meta attributes 
Python :: add readme cmd 
Python :: difference between method and function in pyhon 
Python :: only read some columns from csv 
Python :: python dict remove duplicates where name are not the same 
Python :: translate french to english 
Python :: graph a line from dataframe values over a bar plot in python 
Python :: seaborn.distplot() 
Python :: python cut string to length 
Python :: validate ip address 
Python :: pytorch older versions 
Python :: Format UTC to local timezone using PYTZ for Django 
Python :: how to add coloumn based on other column 
Python :: a string starts with an uppercase python 
Python :: static files not loading 404 error django 
Python :: python 3.7 install snakemake 
Python :: wikipedia python module 
Python :: os.chdir go back 
Python :: numpy generate random array 
Python :: Scrapping tables in an HTML file with BeautifulSoup 
Python :: download csv file from jupyter notebook 
Python :: size array python 
Python :: all the symbols on a keyboard python list 
Python :: df insert 
Python :: line plot python only years datetime index 
Python :: spacy access vocabulary 
Python :: count how much a number is in an array python 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =