I want to pickle a bunch of lists and write each list separately to a fileand
then read them back. Here is my code with the EOF error:
import cPickle as pickle
m = [[1, 2, 3, 4], [5, 6, 7, 8, 9, 10], [11, 12, 13, 14]]
filename = 'lists.txt'
fw = open(filename, 'w')
for l in m:
n = pick
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
please end y tutor e-mail assistance
Thank you
--
Sean Eric Fisher
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Sun, Nov 2, 2008 at 5:11 PM, spir <[EMAIL PROTECTED]> wrote:
> I have just read the following article:
> http://effbot.org/zone/python-objects.htm
> (thanks to a link on Kent's site). It is very good, I really recommend it.
>
> Still, a short passage has troubled my model about object names:
> "
I have just read the following article:
http://effbot.org/zone/python-objects.htm
(thanks to a link on Kent's site). It is very good, I really recommend it.
Still, a short passage has troubled my model about object names:
"The names are a bit different — they’re not really properties of the obje
Please take me oof of the mailing list. thank you [EMAIL PROTECTED]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Sun, Nov 2, 2008 at 3:53 PM, W W <[EMAIL PROTECTED]> wrote:
> is there a better/more pythonic way to do something like this?
>
> spam = ['c','c','v','c','v']
>
> for x in xrange(0,5,2):
> print spam[x], spam[x+1]
You could use this function (from the itertools recipes):
def grouper(n, itera
On Sun, Nov 2, 2008 at 3:40 PM, spir <[EMAIL PROTECTED]> wrote:
> That's it, thank you! I was looking among sequence methods instaed if
> built-in functions.
You're welcome. Making it a function instead of a method allows it to
be applied to any kind of sequence - actually any kind of iterable,
in
is there a better/more pythonic way to do something like this?
spam = ['c','c','v','c','v']
for x in xrange(0,5,2):
print spam[x], spam[x+1]
There are other things I'll be doing with the values, but I want to get them
in chunks of two. (I realize that this code will throw errors, it's just a
On Sun, Nov 2, 2008 at 12:41 PM, spir <[EMAIL PROTECTED]> wrote:
> Sander Sweers a écrit :
>>> Note that this creates a new list, replacing the one that was in
>>> somelist. If you need to actually modify somelist in place (rare) then
>>> use somelist[:] = [ x+1 for x in somelist ]
>>>
>>> which c
On Sun, Nov 2, 2008 at 12:33 PM, spir <[EMAIL PROTECTED]> wrote:
> Excuse me for such a stupid question, I just wish to stop and lose my time
> searching for something that maybe simply does not exist.
> I'm looking for the builtin function for sequences that would return a list
> of (index,item) p
Thanks all,
Yeah, checked the settings, and when i have the thing talk to a
program that just prints out whatever the serial port reads, It was
looking fine.
Incorrect baudrate was my first problem, and did cause weirdness,
escpeially on the latter end of the message, but this isn't the same
proble
Excuse me for such a stupid question, I just wish to stop and lose my time
searching for something that maybe simply does not exist.
I'm looking for the builtin function for sequences that would return a list of
(index,item) pairs to be used in loops. analog to dict's items() function.
[I was wri
Sander Sweers a écrit :
On Sun, Nov 2, 2008 at 13:32, Kent Johnson <[EMAIL PROTECTED]> wrote:
Use a list comprehension:
somelist = [ x+1 for x in somelist ]
Got it.
Note that this creates a new list, replacing the one that was in
somelist. If you need to actually modify somelist in place (ra
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
shawn bright wrote:
> Hey there all,
>
> I have a gps device that talks to the computer over a serial port.
> i am using the pyserial module and getting values in.
Here are the relevant bits of a serial to tcp/ip app that I use. Most
likely you have
On Sun, Nov 2, 2008 at 9:13 AM, Sander Sweers <[EMAIL PROTECTED]> wrote:
> On Sun, Nov 2, 2008 at 13:32, Kent Johnson <[EMAIL PROTECTED]> wrote:
>> Note that this creates a new list, replacing the one that was in
>> somelist. If you need to actually modify somelist in place (rare) then
>> use some
On Sun, Nov 2, 2008 at 13:32, Kent Johnson <[EMAIL PROTECTED]> wrote:
> Use a list comprehension:
> somelist = [ x+1 for x in somelist ]
Got it.
> Note that this creates a new list, replacing the one that was in
> somelist. If you need to actually modify somelist in place (rare) then
> use someli
On Sat, Nov 1, 2008 at 5:40 PM, Sander Sweers <[EMAIL PROTECTED]> wrote:
> Hi,
>
> What is the better way to process data in a list? Make the changes in
> place, for example
>
> somelist = [1,2,3,4]
>
> for x in range(len(somelist)):
>somelist[x] = somelist[x] + 1
>
> Or would making a new list
On Sun, Nov 2, 2008 at 2:32 AM, Jim Morcombe <[EMAIL PROTECTED]> wrote:
> Would pySQLite be a reasonable choice for this?
>From the SQLite docs at http://sqlite.org/whentouse.html:
- A good rule of thumb is that you should avoid using SQLite in
situations where the same database will be accessed s
On Sun, Nov 2, 2008 at 01:23, bob gailer <[EMAIL PROTECTED]> wrote:
>> What is the better way to process data in a list?
>
> Depends on what you mean by "better". Could mean faster, smaller, more
> readable, or ?? Get clear on your goals.
Inexperienced beginner programmer asking more experienced p
shawn bright schreef:
Hey there all,
I have a gps device that talks to the computer over a serial port.
i am using the pyserial module and getting values in.
Here is my delima,
i am supposed to read a message in that starts with a $ (this is all ascii).
but when i do a ser.read(16) and i try t
21 matches
Mail list logo