Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37553
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!feeder1.cambriumusenet.nl!82.197.223.103.MISMATCH!feeder3.cambriumusenet.nl!feed.tweaknews.nl!81.171.88.15.MISMATCH!eweka.nl!lightspeed.eweka.nl!194.134.4.91.MISMATCH!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <insideshoes@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'received:209.85.223': 0.03; 'f.close()': 0.07; 'skip:o 50': 0.07; '#print': 0.09; '"': 0.09; 'correct,': 0.09; 'integers': 0.09; 'skip:o 60': 0.09; 'subject:string': 0.09; 'subject:using': 0.09; 'subject:error': 0.11; 'file,': 0.15; '>>': 0.16; 'csv': 0.16; 'basically': 0.17; 'tries': 0.17; 'to:name:python- list@python.org': 0.20; 'file.': 0.20; 'message- id:@mail.gmail.com': 0.27; 'behaving': 0.29; 'skip:& 10': 0.29; 'subject: : ': 0.30; 'code': 0.31; 'print': 0.32; 'to:addr:python- list': 0.33; 'equal': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'compare': 0.36; 'why': 0.37; 'received:209': 0.37; 'skip:l 20': 0.38; 'to:addr:python.org': 0.39; 'little': 0.39; 'think': 0.40; 'skip:u 10': 0.60; 'different': 0.63; 'here': 0.65; 'results': 0.65; 'programme': 0.69; '11:': 0.84; 'is\xa0': 0.84; '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0': 0.84; '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=mqZ96YL7UvX7Wfj8d9Xx/LCYvipGVTHZNWEjhcodCls=; b=qow2HYt0N+g3lT1d2kgpqQgpo5EON2evlCaFyW55Fpq/v3gftGjqkpEcIk4R+y1S8N ghxA++8E/oeYS7lZ6aSMwbLVhCywZpFfU7+9mzhpvtMk6yywu6eo6BDa/dcVDNrAkkjR Gplk/gj3BO9QJFxxpx1HhCSn0DU7d0hj3yQqKFkgw1vmIuAfztuso6nC6fz8Qv5PdwMY DztnwXhvmkYIVDlhju1iobeJbji8fT7LGBGgH/ITl2AgvMY9Wcp5raMbPPurxebNrQp6 iREnA7BwTdnQ90iTcJ+EYmihLAkLiFWGUEUo76jLuH864qzT3iNOXoY38B+bPs28vGsv YQdg== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.151.195 with SMTP id us3mr912629igb.40.1359023875578; Thu, 24 Jan 2013 02:37:55 -0800 (PST) |
| Date | Thu, 24 Jan 2013 11:37:55 +0100 |
| Subject | using split for a string : error |
| From | inshu chauhan <insideshoes@gmail.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=e89a8f3b9f49585bf804d40667fc |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.953.1359023878.2939.python-list@python.org> (permalink) |
| Lines | 53 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1359023878 news.xs4all.nl 6844 [2001:888:2000:d::a6]:43066 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:37553 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Here I have a code which basically reads a csv file, tries to compare the
last 2 items in each line of the file.
f = open(r"Z:\modules\Feature_Vectors_300_Pclass.arff")
for l in f:
sp = l.split(",")
if len(sp) != 11:
print >> of, l,
else:
#print sp[9], sp[10]
if sp[9] == sp[10]:
print " Same class"
else :
print "Different class"
f.close()
For me I think the programme is logically correct, but its giving me
results which are strange.
It is Printing " Different Class" even when sp[9] is equal to sp[10] and
"Same class" when sp[9] is not equal to sp[10]. and sp[9] and sp[10] are
simple integers like 3, 3, 4 ,4.
I have a little understanding why the programme is behaving like this ?
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
using split for a string : error inshu chauhan <insideshoes@gmail.com> - 2013-01-24 11:37 +0100
csiph-web