D
D
des1roer2015-01-30 07:20:56
Python
des1roer, 2015-01-30 07:20:56

Python + Potgres?

people in general, it became necessary to do the following - connect to pg with a python script to get the data and write it on the web server as date.php . downloaded www.jetbrains.com/pycharm downloaded python.projects.pgfoundry.org but here is the fact and what to do next. I even forgot to import how? tell me pzhs
UPD
the process went faster.
you need to write the array received from the database in the form
[
[1147651200000,67.79],
[1147737600000,64.98],
[1147824000000,65.26],
[1147910400000,63.18]
]
something like this happened

f = open('text.txt', 'w')
r=[]
e=[]
for name,d, in  db.prepare('''SELECT
                              "ID",
                              "FName"
                            FROM
                              "SC_Wonder"."TMineObj" ;'''):
        #print(str(name) + '\n')

        r.append(name)
        e.append(d)
f.write('[')
for i in range(len(d)):
    f.write('['+str(r[i])+','+str(e[i])+']')
f.write("]")
f.close()

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
des1roer, 2015-02-02
@des1roer

des1roer.blogspot.ru/2015/02/python-postgres.html

M
Meehalkoff, 2015-01-30
@Meehalkoff

you have a textbook. there he is

D
Dmitry Demidov, 2015-01-30
@ptitca_zu

Better take this .
There in examples just almost your script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question