parse xml

2011-09-30 Thread
please click the http://www.secinfo.com/d14qfp.q9j.htm then ,click the following: 44: XML IDEA: Condensed Consolidating Statements of Income XML 5.11M (Details)--R158 there is the citigroup's annual financial report --statements of income,xml file. how can i get a table of statemen

回复: how to run in xp?

2011-09-30 Thread
the command : 2to3-3.2 getcode3.py -w can run in linux it can't run in window xp,can i make it in window xp? -- 原始邮件 -- 发件人: "1248283536"<1248283...@qq.com>; 发送时间: 2011年9月28日(星期三) 晚上7:50 收件人: "Peter Otten"<__pete...@web.de>; "python-list"; 主题: Re: how to run in

Re: how to run in xp?

2011-09-28 Thread
it can run ,but there is still a problem ,nothing in my file. please run the code in xp+python32 import urllib.request, urllib.parse, urllib.error exchange=['NASDAQ','NYSE','AMEX'] for down in exchange: url='http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange='+down+'&render=do

how to run in xp?

2011-09-28 Thread
#coding:utf-8 import urllib exchange=['NASDAQ','NYSE','AMEX'] for down in exchange: myfile=open('./'+down,'w') url='http://www.nasdaq.com/screening/companies- \ by-industry.aspx?exchange='+down+'&render=download' file=urllib.urlopen(url).read() myfile.write(file) print ('ok',d

parse html:strange tr problem

2011-09-24 Thread
here is my code: import lxml.html sfile='http://finance.yahoo.com/q/op?s=A+Options' root=lxml.html.parse(sfile).getroot() t = root.xpath("//table[@class='yfnc_datamodoutline1']")[0] trs=t.xpath(".//tr") for i, tr in enumerate(trs): print (i, len(tr),tr.text_content()) the output is: 0 1

Re: parse html:what is the meaning of "//"?

2011-09-16 Thread
through the following code,i get the content of webpage, import lxml.html url = 'http://finance.yahoo.com/q/op?s=C+Options' root = lxml.html.parse(url).getroot() with your method ,how can i get the content of webpage in my python program? -- Original ---

method:wrong structure

2011-09-15 Thread
there are three programs,all of them left main structure, code0 is ok,i don't know why code2 and code3 can't run,how to fix them? code0 class webdata(object): def __init__(self,arg): def loadequity(self): def loadoption(self): #loadstatus={'equ

Connection reset by peer

2011-09-13 Thread
there is a multi-threads program dowloading data from yahoo,the main structure is as the following(omit something unimportant ) class webdata(object): def __init__(self,name): self.jobs = Queue.Queue() if x in name: self.jobs.put(x) def download(self

problem:import csv data

2011-09-13 Thread
import sqlite3 con = sqlite3.connect('/home/stock.db') cur = con.cursor() cur.execute('''CREATE TABLE quote (ticker TEXT,date TEXT, popen TEXT, high TEXT, low TEXT,vol TEXT,adjclose TEXT);''') i=/tmp/data.csv cur.execute('.separator "," ') cur.execute('.import %s quote' % i) con.commit() cur.

回复: strang thing:

2011-09-12 Thread
t;Chris Angelico"; 发送时间: 2011年9月6日(星期二) 下午4:22 收件人: "python-list"; 主题: Re: strang thing: 2011/9/6 守株待兔 <1248283...@qq.com>: > file = open(filename,'r') > when i add(date,open,high,low,close,vol,adjclose) = (row[0], row[1], You're assigning to th

回复: strang thing:

2011-09-12 Thread
t;Chris Angelico"; 发送时间: 2011年9月6日(星期二) 下午4:22 收件人: "python-list"; 主题: Re: strang thing: 2011/9/6 守株待兔 <1248283...@qq.com>: > file = open(filename,'r') > when i add(date,open,high,low,close,vol,adjclose) = (row[0], row[1], You're assigning to th

convert time

2011-09-10 Thread
how can i convert "Dec 11" into 2011-12?-- http://mail.python.org/mailman/listinfo/python-list

回复: my multi-download program can't finish

2011-09-08 Thread
sometimes,the output is: error: [Errno 104] Connection reset by peer -- 原始邮件 -- 发件人: "Steven D'Aprano"; 发送时间: 2011年9月8日(星期四) 中午1:08 收件人: "python-list"; 主题: Re: my multi-download program can't finish On Thu,

multi-down in threading module

2011-09-07 Thread
i want to download data in multiprocess ,i know the threading structure,but i can't finish it, would you mind to revise it ? any advice appreciated. [code] import urllib import threading URL = "http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=sl1t1v&e=.csv"; symbols = ('GGP', 'JPM', 'AIG', '

my multi-download program can't finish

2011-09-07 Thread
here is the program, # basic structure,omit something import Queue import httplib2 import threading jobs = Queue.Queue() name=something #omit ,it is a web list to download for x in name: jobs.put(x) def download(): while not jobs.empty(): try: url

strang thing:

2011-09-06 Thread
i found stange thing that i can't solve import os import csv for name in os.listdir('/tmp/quote/'): filename='/tmp/quote/'+name file = open(filename,'r') file.readline() for row in csv.reader(file): print row[0], row[1], row[2], row[3],row[4], row[5], r

event :use command to replace bind

2011-08-24 Thread
here is my code ,it can run ,i want to make it simpler, to change three sentences to one, xb =Button(root, text='Fetch') xb.pack(side=LEFT) xb.bind("", partial(fetch, entries=ents)) i write: Button(root, text='Fetch',command=partial(fetch, entries=ents)).pack(side=LEFT)

how to write the lambda expression in my tkinter ?

2011-08-22 Thread
from Tkinter import * fields = 'Name', 'Job', 'Pay' def fetch(event,entries): for entry in entries: print 'Input => "%s"' % entry.get() # get text print event.widget def makeform(root, fields): entries = [] for field in fields: row =

same code to login,one is ok,another is not

2011-08-14 Thread
1.http://www.renren.com/Login.do it is ok,my code: import cookielib, urllib2, urllib cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) exheaders = [("User-Agent","Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 5.1; SV1)"),] opener.addheaders=exheaders ur

login with urllib2

2011-08-14 Thread
please to see my code: import urllib import urllib2 url = 'http://hi.baidu.com/' values = {'username' : '**','password' : '**' } data = urllib.urlencode(values) req = urllib2.Request(url,data) response = urllib2.urlopen(req) the_page = response.read() i can't to login ,why?username and

thread and process

2011-08-13 Thread
please see my code: import os import threading print threading.currentThread() print "i am parent ",os.getpid() ret = os.fork() print "i am here",os.getpid() print threading.currentThread() if ret == 0: print threading.currentThread() else: os.wait() print thre

fork problem

2011-08-12 Thread
in the book ,A call to wait() suspends execution (i.e., waits) until a child process (any child process) has completed, terminating either normally or via a signal. wait() will then reap the child, releasing any resources. If the child has already completed, then wait() just performs the reaping

install editra

2011-08-06 Thread
sudo python /opt/Editra-0.6.58/setup.py install Traceback (most recent call last): File "/opt/Editra-0.6.58/setup.py", line 639, in DoSourcePackage() File "/opt/Editra-0.6.58/setup.py", line 498, in DoSourcePackage DATA = GenerateSrcPackageFiles() File "/opt/Editra-0.6.58/setup.py",

scrape text from web

2011-08-05 Thread
python-list@python.org: hi ,everyone, i want to scrap something from http://search.dangdang.com/search_pub.php?key=python my code is : import urllib import lxml.html down='http://search.dangdang.com/search_pub.php?key=python' file=urllib.urlopen(down).read() root=lxml.html.fromstring(file) tnodes

ImportError: No module named PyQt4.QtGui

2011-08-04 Thread
i have installed such things: sudo apt-get install libqt4-dev sudo apt-get install g++ automake sudo apt-get install qt4-dev-tools qt4-designer qt4-doc sudo apt-get install libqt4-opengl-dev sudo apt-get install libqt4-sql-mysql libqt4-sql-odbc libqt4-sql-psql libqt4-sql-sqlite libqt4-sql-sqlite

pygtk

2011-08-02 Thread
please see my attachment ,which widget the region1,region2 is? how to make it?? re2 Description: Binary data -- http://mail.python.org/mailman/listinfo/python-list

how to solve it?

2011-07-31 Thread
from matplotlib.matlab import * Traceback (most recent call last): File "", line 1, in ImportError: No module named matlab-- http://mail.python.org/mailman/listinfo/python-list