Python Forum
Print to Text file in Python 3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Print to Text file in Python 3
#2
You can do
from pathlib import Path
Path('my_variable.txt').write_text(my_variable)
Reply


Messages In This Thread
Print to Text file in Python 3 - by iteachpc - May-01-2019, 06:04 PM
RE: Print to Text file in Python 3 - by Gribouillis - May-01-2019, 07:42 PM
RE: Print to Text file in Python 3 - by perfringo - May-02-2019, 04:38 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to Randomly Print a Quote From a Text File When User Types a Command on Main Menu BillKochman 13 1,012 Apr-24-2024, 05:47 AM
Last Post: Bronjer
  Replace a text/word in docx file using Python Devan 4 3,552 Oct-17-2023, 06:03 PM
Last Post: Devan
  save values permanently in python (perhaps not in a text file)? flash77 8 1,265 Jul-07-2023, 05:44 PM
Last Post: flash77
  Start print a text after open an async task via button Nietzsche 0 728 May-15-2023, 06:52 AM
Last Post: Nietzsche
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 1,151 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  Saving the print result in a text file Calli 8 1,880 Sep-25-2022, 06:38 PM
Last Post: snippsat
  Modify values in XML file by data from text file (without parsing) Paqqno 2 1,726 Apr-13-2022, 06:02 AM
Last Post: Paqqno
  failing to print not matched lines from second file tester_V 14 6,170 Apr-05-2022, 11:56 AM
Last Post: codinglearner
  Print to a New Line when Appending File DaveG 0 1,238 Mar-30-2022, 04:14 AM
Last Post: DaveG
  Print text with big font and style tomtom 5 14,199 Mar-03-2022, 01:29 AM
Last Post: tomtom

Forum Jump:

User Panel Messages

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