473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Python from list to CSV. how to strip unico de chars from results. decide function on

I nave some data get in json anḍ to convertito to CSV.
I m not able to strip ,u'value', iwriting on CSV.
This is the code
Expand|Select|Wrap|Line Numbers
  1. extractwr = csv.writer(myfile)  
  2. for x in range :
  3.  g=str(d[n].values()).strip("{}").split(",")
  4.  repr(g).decode("unicode_escape").encode("utf-8")
  5.  wr.writerow(g)
  6.  n=n+1
  7. myfile.close()
But I get this..
[u'\u20ac 1.195,03', u'22', 22.0, 1.0, u'1', u'EUR', u'EUR', 1195.03, u'\u20ac 1.195,03', 1195.03]
[u'\u20ac 290,36', u'22', 22.0, 0.0, u'0', u'EUR', 290.36]

How to solve?
Mar 20 '15 #1
1 1576
bvdet
2,851 Expert Mod 2GB
Your code will fail at the start of the for loop. Function range has no argument.
Expand|Select|Wrap|Line Numbers
  1. >>> for x in range :
  2. ...     print "XX"
  3. ...     
  4. Traceback (most recent call last):
  5.   File "<interactive input>", line 1, in <module>
  6. TypeError: 'builtin_function_or_method' object is not iterable
  7. >>> 
Mar 21 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Dave Brueck | last post by:
Is anybody else having problems sending email to python-list@python.org? About 48 hours ago or so my posts stopped making it to the list (I usually post via the mailing list rather than to the...
1
by: Dave Brueck | last post by:
The other day I stopped receiving emails from python-list (although python-dev kept going just fine). This morning I decided to investigate and the Mailman page for python-list had my address...
3
by: Brad Clements | last post by:
I have not seen any new posts in gmane.comp.python.general since 6/18/2004. However when I post to gmane, that post seems to make it out to the python list. Does anyone know if its a gmane...
0
by: Heiko Wundram | last post by:
Hi all, esp. list admins! Why is it that I always get bounces saying my mails have suspicious headers lately when I post to python-list? This only happens when I reply to myself (as I just did,...
4
by: Michael Tobis | last post by:
I'm trying to do metaprogramming. I'm sure I've got this all wrong wrong wrong, but somehow my approach hasn't yet hit a brick wall. Anyway, I'd like to dynamically add a method to an instance at...
0
by: Chris | last post by:
Hi I have a C function that builds a list of null terminated strings: void buildStringList(char **asStrings, int n); The number of elements in the list is given in input. I'd like to have...
9
by: Terry Reedy | last post by:
For a couple of years, I have been reading and posting and posting to python-list and c.l.p via gmane.news.orgs gmane.comp.python.general group. Today I got this from 'python-list-bounces', which I...
8
by: jerry.levan | last post by:
Hi, I have a file that contains a "tcl" list stored as a string. The list members are sql commands ex: { begin { select * from foo where baz='whatever'} {select * from gooble } end { insert...
1
by: Tom Stambaugh | last post by:
I continue to receive emails, addressed to python-list-bounces@python.org, with subject: "Re: Your message to Python-list awaits moderator approval", which read: I'm happy to adjust my headers...
0
by: Gareth Owen | last post by:
On Monday 12 May 2008 14:55:06 python-list-request@python.org wrote: If timing is critical, try using a semaphore technique.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.