Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'sys': 0.05; 'everyone!': 0.07; 'filename': 0.07; 'skip:/ 10': 0.07; 'subject:help': 0.07; 'python': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; "'r')": 0.16; '-1:': 0.16; 'advance!': 0.16; 'files")': 0.16; 'points:': 0.16; 'wed,': 0.16; 'wrote:': 0.17; '<': 0.17; 'jan': 0.18; 'code,': 0.18; 'input': 0.18; 'code.': 0.20; 'email addr:gmail.com>': 0.20; 'import': 0.21; 'own.': 0.22; 'cc:2**0': 0.23; 'errors': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'errors.': 0.27; 'label': 0.27; 'message-id:@mail.gmail.com': 0.27; 'run': 0.28; 'url:mailman': 0.29; 'skip:& 10': 0.29; 'url:python': 0.32; 'info': 0.32; 'url:listinfo': 0.32; 'traceback': 0.33; 'code:': 0.33; 'that,': 0.34; 'program,': 0.34; 'received:google.com': 0.34; 'thanks': 0.34; 'list': 0.35; 'skip:l 30': 0.35; 'so,': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'really': 0.36; 'but': 0.36; 'url:org': 0.36; 'useful': 0.36; 'should': 0.36; 'problems': 0.36; 'skip:p 20': 0.36; 'two': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'skip:l 20': 0.38; 'things': 0.38; 'help': 0.40; 'url:mail': 0.40; 'your': 0.60; 'back': 0.62; '30,': 0.62; 'great': 0.64; 'subject': 0.66; 'cut': 0.71; '2013': 0.84; 'descriptive': 0.84; 'dict()': 0.84; 'joel': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=oF5sqcYcsBXRsIcRbQfj0Xlh/wnmVAszkch1A5P5p68=; b=PCXU6hkJf5dvuK//K9FCmlash2glTzJMZysI3oKcZdqmapavbfnyjsK7FkGoELfV1f XWqNwEZUSfJX3eNjeW7ngJwsbmjA+ZHm8r0O6xdE56gNuVz45+rX7/eCMqBLl61orG3M 1vNWNrdccrKGRTyM0Qplfu6tidcscm73tMgq88t6QIUimdbinu9f3fLXnEcfQoMi0O8V rewpjlkFXq+p45OM8t6edUMojsqS6TrsA10jNOZSFzJ1ep+8U1xy6pFR16+lOZfIUKjJ gEKBsJswmIiyThZx5HTO2fcczIQU3BpLAABS9mirp8SiVEgrVEnK8f5ilz5HdJZbUX7v 447w== MIME-Version: 1.0 X-Received: by 10.59.11.67 with SMTP id eg3mr1950527ved.31.1359583789880; Wed, 30 Jan 2013 14:09:49 -0800 (PST) In-Reply-To: References: Date: Wed, 30 Jan 2013 17:09:49 -0500 Subject: Re: help From: Joel Goldstick To: aramildaern@gmail.com Content-Type: multipart/alternative; boundary=047d7bf0ec72d693fd04d488c443 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 176 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1359583792 news.xs4all.nl 6859 [2001:888:2000:d::a6]:41911 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37966 --047d7bf0ec72d693fd04d488c443 Content-Type: text/plain; charset=UTF-8 On Wed, Jan 30, 2013 at 4:16 PM, wrote: > Hi everyone! I don't mean to intrude, but ive heard great things about > this group and ive stumped myself with my python code. > No intrusion. That is what the list is for. Two points: You should use a descriptive subject line -- "Help" isn't really descriptive. You should run your code, cut and paste the traceback you get showing the errors. This is extremely useful for people to help you with, and as you program, you will learn how useful it can be to find problems on your own. So, do that, and come back with that info > > heres my code: > #! /usr/bin/python > > import sys > > global labelList > labelList= dict() > > global counter > counter = 0 > > def execute(line): > if line.find("::print") != -1: > stripPrint = line.find("::print") > startPrint = line.find('"', stripPrint) > stopPrint = line.find('"', startPrint + 1) > printSection = line[startPrint + 1 : stopPrint] > print(printSection) > > if line.find("::label") != -1: > stripLabel = line.find("::label") > startLabel = line.find(' ', stripLabel) > stopLabel = line.find('--', startLabel + 1) > label = line[startLabel + 1 : stopLabel] > line.strip("\r\n") > labelList[label] = counter > > if len(sys.argv) < 2: > print("error: no input files") > print("compilation terminated") > > else: > fileName = sys.argv[1] > jadeFile = open(fileName, 'r') > > for line in jadeFile: > counter = counter + 1 > execute(line) > > jadeFile.close() > > i = 0 > > while i < len(labelList): > print(labelList.keys()[i], ":", labelList.values()[i]) > i = i + 1 > > > and its giving me a bunch of errors thanks for the help in advance! > -- > http://mail.python.org/mailman/listinfo/python-list > -- Joel Goldstick http://joelgoldstick.com --047d7bf0ec72d693fd04d488c443 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Wed, Jan 30, 2013 at 4:16 PM, <aramildaern@gmail.com&g= t; wrote:
Hi everyone! I don't mean to intrude, bu= t ive heard great things about this group and ive stumped myself with my py= thon code.

No intrusion.=C2=A0 That is what the list = is for.

Two points:

You should use a de= scriptive subject line -- "Help" isn't really descriptive.
You should run your code, cut and paste the traceback you get sh= owing the errors.=C2=A0 This is extremely useful for people to help you wit= h, and as you program, you will learn how useful it can be to find problems= on your own.

So, do that, and come back with that info

heres my code:
#! /usr/bin/python

import sys

global labelList
labelList=3D dict()

global counter
counter =3D 0

def execute(line):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if line.find("::print") !=3D -1:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stripPrint =3D line= .find("::print")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 startPrint =3D line= .find('"', stripPrint)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stopPrint =3D line.= find('"', startPrint + 1)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printSection =3D li= ne[startPrint + 1 : stopPrint]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print(printSection)=

=C2=A0 =C2=A0 =C2=A0 =C2=A0 if line.find("::label") !=3D -1:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stripLabel =3D line= .find("::label")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 startLabel =3D line= .find(' ', stripLabel)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stopLabel =3D line.= find('--', startLabel + 1)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 label =3D line[star= tLabel + 1 : stopLabel]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 line.strip("\r= \n")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 labelList[label] = =3D counter

if len(sys.argv) < 2:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print("error: no input files")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print("compilation terminated")

else:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 fileName =3D sys.argv[1]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 jadeFile =3D open(fileName, 'r')

=C2=A0 =C2=A0 =C2=A0 =C2=A0 for line in jadeFile:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 counter =3D counter= + 1
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 execute(line)

=C2=A0 =C2=A0 =C2=A0 =C2=A0 jadeFile.close()

=C2=A0 =C2=A0 =C2=A0 =C2=A0 i =3D 0

=C2=A0 =C2=A0 =C2=A0 =C2=A0 while i < len(labelList):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print(labelList.key= s()[i], ":", labelList.values()[i])
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 i =3D i + 1


and its giving me a bunch of errors thanks for the help in advance!
--
http://mail.python.org/mailman/listinfo/python-list



--
--047d7bf0ec72d693fd04d488c443--