[Tutor] string delimiters

richard kappler richkappler at gmail.com
Wed Jun 3 22:37:52 CEST 2015


figured that out from your last post, and thank you, now I understand how
that works. I thought I was looking for the entire string, not each
character. That bit all makes sense now.

A descriptor is, for example, for the following part of a string '0032.4'
the descriptor would be weight, so the formatted output would be
weight:0032.4, and so on. each bit of the strings in the post where I
provided the two examples has specific meaning, and I have to parse the
lines so that I add a descriptor (okay, bad word, what should I use?) to
each bit of data from the line.

At the moment I'm doing it by position, which is, I'm sure, a really bad
way to do it, but I need this quickly and don't know enough to know if
there is a better way. I have to parse and output the entire line, but
there are, as I said, two 'types' of string and some are variable in
length. I'm eager for direction. What other information would better help
explain?

regards, Richard

On Wed, Jun 3, 2015 at 4:31 PM, Alan Gauld <alan.gauld at btinternet.com>
wrote:

> On 03/06/15 21:23, richard kappler wrote:
>
>> hold the phone!!!!
>>
>> I have no idea why it worked, would love an explanation, but I changed my
>> previous test script by eliminating
>>
>> for tag in ("icdm"):
>>
>
> This loops over the string assigning the characters i,c,d and m to tag
>
>  if 'icdm' in line:
>>
>
> This checks if the 4 character string 'icdm' is in the line.
> Completely different.
>
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>


-- 

Windows assumes you are an idiot…Linux demands proof.


More information about the Tutor mailing list