Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Writing variable to file
#1
Hi!

I have a piece of code:

import csv
csv_reader = csv.reader(open("utfil.csv", "rb"), delimiter=';', quoting=csv.QUOTE_NONE)
for fields in csv_reader:
print fields

How to get the outcome of "print fields" to be written to a new csv-file "utfil2.csv"?

Thanks for your effort!

/Paul

import csv
csv_reader = csv.reader(open("utfil.csv", "rb"), delimiter=';', quoting=csv.QUOTE_NONE)
for fields in csv_reader:
print fields
Reply
#2
This looks like a good tutorial to view: https://code.tutsplus.com/tutorials/how-...-cms-29907
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Function parameter not writing to variable Karp 5 894 Aug-07-2023, 05:58 PM
Last Post: Karp
  Writing string to file results in one character per line RB76SFJPsJJDu3bMnwYM 4 1,309 Sep-27-2022, 01:38 PM
Last Post: buran
  Writing to json file ebolisa 1 970 Jul-17-2022, 04:51 PM
Last Post: deanhystad
  Writing to External File DaveG 9 2,411 Mar-30-2022, 06:25 AM
Last Post: bowlofred
  Writing to file ends incorrectly project_science 4 2,642 Jan-06-2021, 06:39 PM
Last Post: bowlofred
  Writing unit test results into a text file ateestructural 3 4,654 Nov-15-2020, 05:41 PM
Last Post: ateestructural
  Writing to file in a specific folder evapa8f 5 3,337 Nov-13-2020, 10:10 PM
Last Post: deanhystad
  Failure in writing binary text to file Gigux 7 3,718 Jul-04-2020, 08:41 AM
Last Post: Gigux
  writing data to a csv-file apollo 1 2,329 Jul-03-2020, 02:28 PM
Last Post: DeaD_EyE
  Writing to File Issue Flash_Stang 3 2,477 Jun-05-2020, 05:14 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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