0

I have a list of coordinates and I want to store them in columns The list is like and they are created according to the loop so they keep on changing when the loop enters the next image.

CC = [ (113,254),(163,253),(230,252),......]
CC = [ (0,2128),(163,253),(229,252),......]

I used the below code to create the csv file and store it

with open( "XY.csv", "a") as out_file:
                out_string = ""
                out_string += str(simg_name)
                out_string +=  "," + ",".join([str(i) for i in CC])
                out_string += "\n"
                out_file.write(out_string)

But it stores like enter image description here

I want it to be and remove the "(" ")" also

enter image description here

Krupali Mistry
  • 624
  • 1
  • 9
  • 23
  • can you try `pd.DataFrame(CC).to_csv('filename',index=False)` ? – anky Oct 08 '20 at 02:42
  • I tried but I want to add `simg_name` name too and there are 10 images – Krupali Mistry Oct 08 '20 at 02:49
  • 1
    It will be better if you can create a reproducible example in the question – anky Oct 08 '20 at 02:50
  • 1
    Always provide a [mre], with **code, data, errors, current output, and expected output, as [formatted text](https://stackoverflow.com/help/formatting), [Not Screenshots](https://meta.stackoverflow.com/questions/303812/)**. It is likely the question will be down-voted and closed. You are discouraging assistance because no one wants to retype your data or code, and screenshots are often illegible. [edit] the question and **add text**. Please see [How to provide a reproducible copy of your DataFrame using `df.head(30).to_clipboard(sep=',')`](https://stackoverflow.com/questions/52413246). – Trenton McKinney Oct 08 '20 at 05:08

0 Answers0