KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am executing a mysql query in python using the MySQLdb package. The code looks something like this: c=db.cursor() c.execute("""select * from table""") output = [] for row in c: output.append(row[4]) where row[4] contains a decimal value that I want to store in the output list. The problem is every value that I am getting looks like this: Decimal('XX.XX') where all I want in the output list is XX.XX. At the end of the script, my output list looks like this: [Decimal('10.02'), Decimal('20.24'), ...] But I need it to just contain the numbers, like this: [10.02, 20.24, ...] How do I do that? Thanks!
Tags (comma-separated)
Save Edits
Cancel