Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37966
| References | <cf3b0f42-a133-45df-b1c8-8291b1896878@googlegroups.com> |
|---|---|
| Date | 2013-01-30 17:09 -0500 |
| Subject | Re: help |
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1232.1359583792.2939.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On Wed, Jan 30, 2013 at 4:16 PM, <aramildaern@gmail.com> 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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
help aramildaern@gmail.com - 2013-01-30 13:16 -0800 Re: help Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-30 15:08 -0700 Re: help Joel Goldstick <joel.goldstick@gmail.com> - 2013-01-30 17:09 -0500 Re: help Chris Angelico <rosuav@gmail.com> - 2013-01-31 09:20 +1100 Re: help Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-31 13:42 +1100 Re: help Dave Angel <d@davea.name> - 2013-01-30 22:13 -0500
csiph-web