Python Forum
Saving the print result in a text file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Saving the print result in a text file
#6
You can print into file (unpack, separate with newline and direct stream to file):

with open('ip_out.csv', 'w') as f:
    print(*results, sep='\n', file=f)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
Saving the print result in a text file - by Calli - Sep-24-2022, 04:22 PM
RE: Saving the print result in a text file - by perfringo - Sep-25-2022, 10:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Cannot get cmd to print Python file Schauster 11 440 May-16-2024, 04:40 PM
Last Post: xMaxrayx
  How to Randomly Print a Quote From a Text File When User Types a Command on Main Menu BillKochman 13 1,197 Apr-24-2024, 05:47 AM
Last Post: Bronjer
  Start print a text after open an async task via button Nietzsche 0 748 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,175 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  Saving the times a script is run to a file or ... 3Pinter 7 1,515 Oct-19-2022, 05:38 PM
Last Post: 3Pinter
  Code Assistance needed in saving the file MithunT 0 850 Oct-09-2022, 03:50 PM
Last Post: MithunT
  Modify values in XML file by data from text file (without parsing) Paqqno 2 1,763 Apr-13-2022, 06:02 AM
Last Post: Paqqno
  failing to print not matched lines from second file tester_V 14 6,264 Apr-05-2022, 11:56 AM
Last Post: codinglearner
  Print to a New Line when Appending File DaveG 0 1,249 Mar-30-2022, 04:14 AM
Last Post: DaveG
  Print text with big font and style tomtom 5 14,415 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