Deutsch English Français Italiano |
<l6k4frFhatiU10@mid.individual.net> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: rbowman <bowman@montana.com> Newsgroups: comp.os.linux.advocacy Subject: Re: Tabs As Syntax Date: 28 Mar 2024 02:54:52 GMT Lines: 44 Message-ID: <l6k4frFhatiU10@mid.individual.net> References: <17be73f7d87a06e9$246570$4075406$802601b3@news.usenetexpress.com> <utejt0$1fq95$1@dont-email.me> <uterkv$1haln$2@dont-email.me> <l624u3Fn16lU13@mid.individual.net> <uthf4s$28e7g$1@dont-email.me> <l64bi6F2m1hU17@mid.individual.net> <uu1o5o$30dhk$1@dont-email.me> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net lSZi5aoQbIoWzdAukDqwWwmgfR6yTlJdMaj7C5szT3uR9jjvqL Cancel-Lock: sha1:ozSVOIPkqmVWkm0yJzZ4zAh171Q= sha256:HLH/9UVKNHX4ZRnU3l8Tgr/nIeysgBi+A3JPw873QEA= User-Agent: Pan/0.149 (Bellevue; 4c157ba) Bytes: 1984 On Wed, 27 Mar 2024 14:22:46 -0400, DFS wrote: > import time for i in range(5): > print(i+1,"Never again!",end='\r',flush=True) > time.sleep(0.5) Odd. import time print("start") for i in range(5): print("never again!",end='\r') time.sleep(0.5) print("\ndone") You don't need the sleep either. print(i, "never again!",end='\r') without the sleep gives $ python junk.py start 4 never again! done Put the sleep back in and you can see it counting up. It must be a timing thing in the console. My original use was reading a DHT11 with a Pico using MicroPython https://www.mouser.com/datasheet/2/758/DHT11-Technical-Data-Sheet- Translated-Version-1143054.pdf The print() output goes to the terminal in VS Code. I wanted the update to be temperature: 68.0 F humidity: 36% and stay on the one line without scrolling each second. You can't read the DHT11 faster than once a second so it worked fine. end='\n' is the default for print() and exactly what I didn't want.