Hi all
I have two files (File A and File B) with strings of data in them (each string
on a separate line). Basically, each string in File B will be compared with all
the strings in File A and the resulting output is to show a list of
matched/unmatched lines and optionally to write to a third Fi
On 02/12/12 19:53, Spectral None wrote:
However, it seems that the results do not correctly reflect the
matched/unmatched lines. As an example, if FileA contains "string1"
and FileB contains multiple occurrences of "string1", it seems that
the first occurrence matches correctly but subsequent "
On 12/02/2012 03:53 AM, Spectral None wrote:
> Hi all
>
> I have two files (File A and File B) with strings of data in them (each
> string on a separate line). Basically, each string in File B will be compared
> with all the strings in File A and the resulting output is to show a list of
> match
>> How can I pack a unicode string using the struct module? If I simply use
>> packed = struct.pack(fmt, hello) in the code below (and 'hello' is a
>> unicode string), I get this: "error: argument for 's' must be a string". I
>> keep reading that I have to encode it to a utf-8 bytestring, but this
>
> * some encodings are more compact than others (e.g. Latin-1 uses
> one byte per character, while UTF-32 uses four bytes per
> character).
I read that performance of UTF32 is better ("UTF-32 advantage: you don't need
to decode
stored data to the 32-bit Unicode
code point for e.g. char
> to make is that the transform formats are multibyte encodings (except
> ASCII in UTF-8), which means the expression str(len(hello)) is using
> the wrong length; it needs to use the length of the encoded string.
> Also, UTF-16 and UTF-32 typically have very many null bytes. Together,
> the
On 12/02/2012 08:34 AM, Albert-Jan Roskam wrote:
>
>
>
>
>
>
> Hi Eryksun,
>
> Observation #1: Yes, makes perfect sense. I should have thought about that.
> Observation #2:
> As I emailed earlier today to Peter Otten, I thought unicode_internal means
> UCS-2 or UCS-4,
> depending on the size o
Luke,
Thanks. The generator syntax is really cool.
--
Ashfaq
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Hello, I am trying to write a program which takes two lines of input, one
called "a", and one called "b", which are both strings, then outputs the
number of times a is a substring of b. If you could give me an
algorithm/pseudo code of what I should do to create this program, I would
greatly appreci
On 03/12/2012 03:59, rajesh mullings wrote:
Hello, I am trying to write a program which takes two lines of input, one
called "a", and one called "b", which are both strings, then outputs the
number of times a is a substring of b. If you could give me an
algorithm/pseudo code of what I should do t
On Sun, Dec 2, 2012 at 2:32 AM, Steven D'Aprano wrote:
>
>> ~i returns the value (-i - 1):
>
> Assuming certain implementation details about how integers are stored,
> namely that they are two-compliment rather than one-compliment or
> something more exotic.
Yes, the result is platform dependent,
The Python version, is Python 3.
On Sun, Dec 2, 2012 at 10:59 PM, rajesh mullings wrote:
> Hello, I am trying to write a program which takes two lines of input, one
> called "a", and one called "b", which are both strings, then outputs the
> number of times a is a substring of b. If you could giv
On Sun, Dec 2, 2012 at 8:34 AM, Albert-Jan Roskam wrote:
>
> As I emailed earlier today to Peter Otten, I thought unicode_internal means
> UCS-2 or UCS-4, depending on the size of sys.maxunicode? How is this related
> to UTF-16 and UTF-32?
UCS is the universal character set. Some highlights of th
On Sun, Dec 2, 2012 at 8:41 PM, Ashfaq wrote:
> Luke,
>
> Thanks. The generator syntax is really cool.
>
I misspoke, the correct term is "list comprehension". A generator is
something totally different! Sorry about the confusion, my fault. I type
too fast sometimes :)
Glad you liked it though
There is an equivalent page in the documentation for Python 3 as well,
regarding strings.
This sounds a lot like a homework problem so you are unlikely to get a lot
of help. You certainly won't get exact code.
What have you tried so far? Where are you getting stuck? We're not here
to write cod
15 matches
Mail list logo