Python Forum
Want to Save Print output in csv file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Want to Save Print output in csv file
#1
Sad 
I want to save this print output to CSV file but this code is not working, how can I save this output to CSV?

import csv

for x in range(2000, 3000):
    print('hi', x, sep='')

f = open('op2.csv', 'w')
writer = csv.writer(f)
writer.writerow(print())
f.close()
Reply


Messages In This Thread
Want to Save Print output in csv file - by Rasedul - Jan-11-2022, 02:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Cannot get cmd to print Python file Schauster 11 717 May-16-2024, 04:40 PM
Last Post: xMaxrayx
  Open/save file on Android frohr 0 443 Jan-24-2024, 06:28 PM
Last Post: frohr
  how to save to multiple locations during save cubangt 1 655 Oct-23-2023, 10:16 PM
Last Post: deanhystad
  save values permanently in python (perhaps not in a text file)? flash77 8 1,435 Jul-07-2023, 05:44 PM
Last Post: flash77
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 1,246 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  Save and Close Excel File avd88 0 3,457 Feb-20-2023, 07:19 PM
Last Post: avd88
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 1,264 Jan-16-2023, 07:38 PM
Last Post: Skaperen
  Save multiple Parts of Bytearray to File ? lastyle 1 1,031 Dec-10-2022, 08:09 AM
Last Post: Gribouillis
  How to output one value per request of the CSV and print it in another func? Student44 3 1,494 Nov-11-2022, 10:45 PM
Last Post: snippsat
  Saving the print result in a text file Calli 8 2,051 Sep-25-2022, 06:38 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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