Python Forum
[PyGUI] How to store continous output into a text file?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGUI] How to store continous output into a text file?
#1
I am new to the Python coding , so anyone please guide me. I want to store the output into a text file. From the below code, i am able to read the data in a Python Shell.

[python]
import serial.tools.list_ports

list = serial.tools.list_ports.grep('VID:PID=10C4:EA60','hwid')
connected = []
for element in list:
connected.append(element.device)
a=str(connected)

try:
port = connected[0]
baud = 115200
ser = serial.Serial(port, baud, timeout=1)
#input1.encode('UTF-8')
if ser.isOpen():
print(ser.name + ' is open...')
while (1):
out1 = ser.read()
print out1,
ser.close()
except:
pass
For above code, i got the below output
Output:
tx data=10513 tx data=10514 tx data=10515 tx data=10516 tx data=10517 tx data=10518 tx data=10519 4 tx data=10520 tx data=10521 tx data=10522
Reply


Messages In This Thread
How to store continous output into a text file? - by Saraswathy - Aug-24-2018, 12:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Kivy] Create a function to store text fields and drop downs selection in KivyMD floxia 0 1,858 Dec-18-2022, 04:34 AM
Last Post: floxia
  Active tkinter text output during loop dvanommen 2 11,022 Oct-18-2019, 02:23 PM
Last Post: dvanommen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020