String to List Question

2009-07-02 Thread Hanna Michelsen
Hi,

I am brand new to python and I love it, but I've been having some trouble
with a file parser that I've been working on. It contains lines that start
with a name and then continue with names, nicknames and phone numbers of
people associated with that name. I need to create a list of the names of
people associated with each singular person (the first name in each line).
Each name/phone number is separated by a tab but if someone doesn't have a
nickname there are two tabs between their name and number.

I've been trying to figure out how to test for two tabs, skip over these
people and move onto the next name but I just can't figure out how that will
work in python.

Any help would be greatly appreciated!

Thanks,
Hanna
-- 
http://mail.python.org/mailman/listinfo/python-list


Write matrix to text file

2009-07-06 Thread Hanna Michelsen
Hi,

I'm working with both python and matlab at the moment and I was wondering if
there is an efficient way to take a 2-D array (of 1s and 0s) in python and
write it to a text file such that matlab will be able to create a sparse
matrix from it later.

Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Write matrix to text file

2009-07-07 Thread Hanna Michelsen
Hi,

I'm working with both python and matlab at the moment and I was wondering if
there is an efficient way to take a 2-D array (of 1s and 0s) in python and
write it to a text file such that matlab will be able to create a sparse
matrix from it later.

Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Writing a single list of numbers to a .m (matlab) file

2009-07-17 Thread Hanna Michelsen
Hi,

I was wondering if I could get some suggestions on how to write a single
list of numbers to a .m file (for matlab) so that I can create a matlab
vector out of the list of numbers from my python program. I have been using
a csv writer to create .m files from lists of lists, but I'm not sure how to
write just a single list to the file. (if I use the same code I've been
using, I get an error: csv.Error sequence expected)

Thanks for the help!
-- 
http://mail.python.org/mailman/listinfo/python-list