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


Groups > comp.lang.python > #13206

回复: strang thing:

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=1315883526; bh=TaZM9E+O8jbUTxvGsKLc6sN+TM0pneEpJ4dNgQBMyEc=; 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; b=Senmks2/1B484jpQqODXQBQ9QAWcTRKlOQAbsacT0iwKG7ZLIhOK9ceZO+6jZLyct R0kSArghDVFQREflAZGCnocUsrqpI8odx3LlzZDqUkHWlS0+3WNRC7EFjnD72c1
X-QQ-SSF 00000000000000F0000000000000000
X-QQ-BUSINESS-ORIGIN 2
X-Originating-IP 113.116.235.147
X-QQ-STYLE
X-QQ-mid webmail415t1315883523t62282
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_4E6ECA03_DF06FA90_73615944"
Content-Transfer-Encoding 8Bit
Date Tue, 13 Sep 2011 11:12:03 +0800
X-Priority 3
X-QQ-MIME TCMime 1.0 by Tencent
X-Mailer QQMail 2.x
X-QQ-Mailer QQMail 2.x
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.1056.1315883528.27778.python-list@python.org> (permalink)
Lines 75
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1315883528 news.xs4all.nl 2456 [2001:888:2000:d::a6]:37299
X-Complaints-To abuse@xs4all.nl
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:13206

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:12 +0800

csiph-web