On 04/03/2019 08:04, Edward Kanja wrote: > ... Unfortunately after i extract the data > my output has too much of square brackets and by so doing the output cant > be well exported in a csv file.
I can't see the data so can't be definitive but the number of square brackets shouldn't affect a CSV file (except that it will be messy to read). Are you using the csv module to produce the csv file? It is much safer to do that than to try to write a csv file yourself. > I have worked on an idea of Re.sub function > where i'm trying to replace all square brackets in my output with an empty > string. See Steve's reply. > Below are images of what i have been working on. Images don't work on this (and many other) mailing list. The server sees them as potential security threats and throws them away. Please put sample code directly in the mail message or, if it is very long ( >100 lines?) paste it on a pastebin type web site and include a link. > 4.*try one code. > *6. try two code: > *8.try four code. > *10.try five code. > *13.try six code. Multiple versions of the code just results in confusion as different people respond to different versions. Pick one version that's closest to what you want and use that as the basis of discussion. Ideally remove all code that's not directly relevant to the problem, eg the code that loads your data in the first place. Show a small sample of input data and the output data. Show us any error messages in full. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
