Hey Everyone,
Running into a bit of a problem that I am not sure how to resolve after researching for awhile, What I would like to do is write my results from a search cursor to an existing column in a csv file.
So currently this is the code I have;
The first portion of my code works exactly how I want it too, and prints how I would like it to be displayed in the csv file. Now what I would like to do is take those values and write them to an existing Field in my CSV called "Play", I am not sure how to go about this. This is what I have gotten so far for my results..
The highlighted portion is what I want to write to the specific column "Play" in my csv, I can read the file and find out the column position is row[0] but cant write to it.
Any help is appreciated!
Solved! Go to Solution.
I took a read through it all, was quite a lot of information to take in but I ended up getting it to work with just one hiccup,
My data that is put into that column contains a space between each one, as seen below;
not sure why.. but other then that it works!
Here is the code
You need a writer to write. Check the example here: 13.1. csv — CSV File Reading and Writing — Python 2.7.15 documentation
I took a read through it all, was quite a lot of information to take in but I ended up getting it to work with just one hiccup,
My data that is put into that column contains a space between each one, as seen below;
not sure why.. but other then that it works!
Here is the code
Weird, do you see anything funny (newline character) if you open it in a simple text editor?
No when I open it with just notepad it looks correct,
Although NotePad ++ gives me the same as the excel as well
very weird indeed! Anyways thank you for the link to the CSV Writer info though, that was very helpful.
Oh, try using 'wb' mode rather than 'w' with Python 2 on Windows.
Yup that did it!