104-Python (Text) File Write

658 views · Published 19 December 2016 · 2:42 · Indexed 28 October 2026

Channel: tsbrownie · 2016 · Science & Technology

Watch on YouTube

This is an example of how to write to a file from a python program.  It writes in text format (as opposed to binary). 

This is part of a folder (a little library) of small bits of tested code that work.  Things like file I/O, interrupts, GPIO definitions, print examples, etc.  I don't have to re-invent the wheel every time I write a program.  I can go to that folder, copy the pieces I need and be done with my program quickly and with less thrashing.

MATERIALS
- Library folder
- Individual files for each function (ex: FileIO.py, Array.py, ...)

PYTHON SOFTWARE LIBRARY (grouped by type and listed in order of difficulty)
001-Python Library of Tips & Tricks
https://www.youtube.com/watch?v=40D7QIE9IRA

103-Python-File Read
https://www.youtube.com/watch?v=QQi_L7FUn7Q

104-Python (Text) File Write 
https://www.youtube.com/watch?v=SSTA5vRUgYE

105-Python - Directory File Search & Verify 
https://www.youtube.com/watch?v=wvdD07R501o

110-Python-Floating Point Accuracy 
https://www.youtube.com/watch?v=ksNjjY-sl3o

120-Python - Format Numbers 
https://www.youtube.com/watch?v=tJFvvGa72H8

130-Python - Simple Print Formatting 
https://www.youtube.com/watch?v=jv1156O4UMY

140-Python - if, elif, else & CASE? 
https://www.youtube.com/watch?v=rN2R2aciyGs

201-Python - 2D Array Example 
https://www.youtube.com/watch?v=QgfUT7i4yrc

202-Python - 3D Array Example
https://www.youtube.com/watch?v=YlY1rF6pjZU

210-Python - Get Multiple Variables With 1 Line of Input! 
https://www.youtube.com/watch?v=K8l9Lo967Is

211-Python - Get Multiple Variables From 1 Lin - Split/Replace Complex 
https://www.youtube.com/watch?v=C_Rsf63dTCk

301-Python - Function, Simple 
https://www.youtube.com/watch?v=RFzdLOrmHnU

302-Python - Function, Complex 
https://www.youtube.com/watch?v=4LqibspABWs

310-Python - Random Numbers (integer & float) 
https://www.youtube.com/watch?v=4-q-5q1c30U

500-Python - Graphics, Simple Circle Example
https://www.youtube.com/watch?v=8aB9AOEi0Xw

701-Python - Bit Shifting (needed for I2C stuff)
https://www.youtube.com/watch?v=li1xGSlJKrw

710-Python - Recursion
https://www.youtube.com/watch?v=pTrbv0Z8Jck

More from this channel