Thanks Japhy Bartlett!
[[0] for i in range(5)]
Works! I converted to fit into my routine as:
lens = [[] for i in range(len(catalog2[0]))] << the new statement
for row in catalog2:
for col, item in enumerate(row):
lens[col].append(len(item))
lens = [max(col) for col in lens]
On 20Aug2014 16:35, Dima Kulik wrote:
Hi to all. I have a problem with parsing file.
I have txt file exported from AD and it has such structure:
DistinguishedName : CN=*** ,OU=*** ,OU=*** ,DC=*** ,DC=***,DC=***
GroupCategory : Distribution
GroupScope : Universal
Name : *
this forms a list of integers
>>> [0]*5
[0, 0, 0, 0, 0]
what I think you want is something like:
>>> [[0] for i in range(5)]
[[0], [0], [0], [0], [0]]
(a list of lists)
>>> foo = [[0] for i in range(5)]
>>> foo[3].append('bar')
>>> foo
[[0], [0], [0], [0, 'bar'], [0]]
On Wed, Aug 20, 2014 a
On 20/08/14 20:06, Terry--gmail wrote:
We are not quite out of the woods on this last example
lens = [0] * len(catalog2[0])
This is what happens when you don't test code.
My apologies, the initialisation is all wrong.
Try this instead:
lens = [ [] for n in catalog2[0] ]
That adds an empt
>
> lens = [0] * len(catalog2[0])
Ah. Read the following closely:
https://docs.python.org/2/faq/programming.html#how-do-i-create-a-multidimensional-list
If you have any questions, please feel free to ask further. See if
that clears up the mistake that's in your code.
___
> i need to export to file all stings which start from "Name"
>
> I've tried to make little parser:
>
> keywords = ['Name', 'Name:']
> input_file=open("Mail_Groups.txt","r").readlines()
> output_file=open("Out.txt","w")
> for line in input_file:
> for word in line.split():
> if word in
Hi Marc Tompkins!
You are absolutely right that
lens = [0] * len(catalog2[0])
Just creates a list of integers!
Here is what happened, my original method of finding the maximum element
sizes in the 9 x ? block of data held in catalog2, only needed a final
list of integers to contain it. Howe
Dima Kulik Wrote in message:
Please post in text mode. The html mode you used can cause
multiple problems.
Please specify your Python version and os version in any new
thread.It sometimes makes a big difference in the
solution.
Your primary problem is that you don't close the files.
But yo
Terry--gmail wrote:
> Marc, my understanding is, is that:
>
> lens[col].append(len(item))
>
> -should be building a mirror image of my list of lists called catalog2,
> which currently has 9 columns by x number of rows, and that we are
> plugging into these positions, the sizes of all the el
On Wed, Aug 20, 2014 at 1:38 PM, Terry--gmail wrote:
> Marc, my understanding is, is that:
>
> lens[col].append(len(item))
>
> -should be building a mirror image of my list of lists called catalog2,
> which currently has 9 columns by x number of rows, and that we are plugging
> into these posi
Marc, my understanding is, is that:
lens[col].append(len(item))
-should be building a mirror image of my list of lists called catalog2,
which currently has 9 columns by x number of rows, and that we are
plugging into these positions, the sizes of all the elements in that
block of data.
On Aug 20, 2014 12:07 PM, "Terry--gmail" wrote:
>
> Alan Gauld
>
> Hi!
> We are not quite out of the woods on this last example you gave me. It
now seems to be complaining
> that it doesn't want to append an integer to the list or that this isn't
the place to use '.append' -- I am probably interp
On Wed, Aug 20, 2014 at 6:45 AM, diliup gabadamudalige
wrote:
> Hi Danny!
>
> The routine works fine and so does this one.
>
> http://www.pygame.org/pcr/zipshow/index.php
>
> The only problem with all these are that that the time taken to read these
> files and to either make a list or send to scr
Alan Gauld
Hi!
We are not quite out of the woods on this last example you gave me. It
now seems to be complaining
that it doesn't want to append an integer to the list or that this isn't
the place to use '.append' -- I am probably interpreting it's complaint
wrong:
Python 3.3
If I run this
On Wed, Aug 20, 2014 at 2:40 PM, Joel Goldstick
wrote:
> On Wed, Aug 20, 2014 at 2:34 PM, Joel Goldstick
> wrote:
>> On Wed, Aug 20, 2014 at 7:00 AM, abid saied wrote:
>>>
>>> # OK, I'm stuck on setting up an instruction that ends the program once
>>> you
>>> # say either 'yes' or 'no'.
On Wed, Aug 20, 2014 at 2:34 PM, Joel Goldstick
wrote:
> On Wed, Aug 20, 2014 at 7:00 AM, abid saied wrote:
>>
>> # OK, I'm stuck on setting up an instruction that ends the program once
>> you
>> # say either 'yes' or 'no'. And if you don't say 'yes' or 'no', and you
>> reach
>> # t
On Wed, Aug 20, 2014 at 7:00 AM, abid saied wrote:
>
> # OK, I'm stuck on setting up an instruction that ends the program once
> you
> # say either 'yes' or 'no'. And if you don't say 'yes' or 'no', and you
> reach
> # the end, the program comes to an end. Please remember I'm a newbi
Hi to all. I have a problem with parsing file.
I have txt file exported from AD and it has such structure:
DistinguishedName : CN=*** ,OU=*** ,OU=*** ,DC=*** ,DC=***,DC=***
GroupCategory : Distribution
GroupScope : Universal
Name :
ObjectClass : group
ObjectGUI
Hi Danny!
The routine works fine and so does this one.
http://www.pygame.org/pcr/zipshow/index.php
The only problem with all these are that that the time taken to read these
files and to either make a list or send to screen is WAY TOO LONG.
The only one that works without much delay is in the fi
# OK, I'm stuck on setting up an instruction that ends the program once you
# say either 'yes' or 'no'. And if you don't say 'yes' or 'no', and you
reach
# the end, the program comes to an end. Please remember I'm a newbie and
would
# appreciate any advise in plain simple
On Aug 19, 2014 11:53 PM, "diliup gabadamudalige" wrote:
>
> Hi all!
>
> Is there any way I can bundle all my graphics only using Python and
Pygame so that the user may not be able to read them out of the program?
(Changing subject line to more descriptive title)
Would something like http://www.
21 matches
Mail list logo