Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #13205

回复: strang thing:

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <1248283536@qq.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.084
X-Spam-Evidence '*H*': 0.83; '*S*': 0.00; 'string.': 0.04; 'function,': 0.07; 'csv': 0.09; 'skip:" 40': 0.15; 'helps!': 0.16; 'open()': 0.16; 'row': 0.16; 'to:name:python-list': 0.18; 'to:2**1': 0.20; 'trying': 0.21; 'assigning': 0.23; 'loop,': 0.23; 'skip:( 30': 0.24; '&gt;': 0.26; 'skip:( 40': 0.28; 'url:mailman': 0.28; 'import': 0.28; 'second': 0.29; 'print': 0.29; 'usual': 0.31; 'error': 0.32; 'to:addr:python-list': 0.33; 'url:listinfo': 0.33; 'calling': 0.33; 'do?': 0.34; 'file': 0.36; 'url:python': 0.36; 'skip:" 10': 0.36; 'but': 0.37; 'open': 0.37; 'skip:\xcf 10': 0.38; 'url:org': 0.38; 'skip:o 20': 0.38; 'skip:- 10': 0.39; 'header:Mime-Version:1': 0.39; 'data': 0.39; 'to:addr:python.org': 0.39; 'your': 0.61; 'hope': 0.61; 'you.': 0.62; '8bit%:19': 0.67; '8bit%:24': 0.84; '8bit%:60': 0.84; 'subject:thing': 0.84; 'subject::': 0.87; '8bit%:67': 0.93; 'subjectcharset:gbk': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s0907; t=1315883340; bh=ADXrOg7/TBO3U17bvXAM3UfHbwxXhO4g4oZltsCATBI=; h=X-QQ-SSF:X-QQ-BUSINESS-ORIGIN:X-Originating-IP:X-QQ-STYLE: X-QQ-mid:From:To:Subject:Mime-Version:Content-Type: Content-Transfer-Encoding:Date:X-Priority:Message-ID:X-QQ-MIME: X-Mailer:X-QQ-Mailer:X-QQ-ReplyHash; b=VMU/K91JfDAXlRgk/2qbFyTnVyQ2YaLt/6NHwhZw5IBEzDYnYCmLB6P3L7DTos8YA axlocLIQRgMkB3tFnAjg+JE7XA8wTyLsfajVysZwtlh5Y3VAKoZnvmT7Kdb5hgz
X-QQ-SSF 00000000000000F0000000000000000
X-QQ-BUSINESS-ORIGIN 2
X-Originating-IP 113.116.235.147
X-QQ-STYLE
X-QQ-mid webmail415t1315883337t119741
From "守株待兔" <1248283536@qq.com>
To "Chris Angelico" <rosuav@gmail.com>, "python-list" <python-list@python.org>
Subject 回复: strang thing:
Mime-Version 1.0
Content-Type multipart/alternative; boundary="----=_NextPart_4E6EC949_DF229C60_5EF2F504"
Content-Transfer-Encoding 8Bit
Date Tue, 13 Sep 2011 11:08:57 +0800
X-Priority 3
X-QQ-MIME TCMime 1.0 by Tencent
X-Mailer QQMail 2.x
X-QQ-Mailer QQMail 2.x
X-QQ-ReplyHash 1477763885
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1055.1315883354.27778.python-list@python.org> (permalink)
Lines 76
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1315883354 news.xs4all.nl 2468 [2001:888:2000:d::a6]:52082
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:13205

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

i change  open into open1,it's ok now
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):
            (date,open1,high,low,close,vol,adjclose) = (row[0], row[1], row[2], row[3],row[4], row[5], row[6])
            print   row[0], row[1], row[2], row[3],row[4], row[5], row[6]


but i want "open"  to be my data field,not  open1  to be my field ,
how can i do?
 
 
------------------ 原始邮件 ------------------
发件人: "Chris Angelico"<rosuav@gmail.com>;
发送时间: 2011年9月6日(星期二) 下午4:22
收件人: "python-list"<python-list@python.org>; 

主题: Re: strang thing:

 
2011/9/6 守株待兔 <1248283536@qq.com>:
>     file = open(filename,'r')

> when i  add    (date,open,high,low,close,vol,adjclose) = (row[0], row[1],

You're assigning to the name "open", which is shadowing the built-in
of the same name. The second time through the loop, you're not calling
the usual open() function, you're trying to call your string. That's
what your error is telling you.

Hope that helps!

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

回复: strang thing: "守株待兔" <1248283536@qq.com> - 2011-09-13 11:08 +0800

csiph-web