Re: String question

2008-06-24 Thread Terry Reedy
[EMAIL PROTECTED] wrote: On Jun 24, 5:38 am, "Mark Tolonen" <[EMAIL PROTECTED]> wrote: In Python 3k I believe you can put a * next to one of the variables to hold multiple arguments. That'll be aidful! IDLE 3.0b1 >>> a,b,*c=[1,2,3,4,5] >>> c [3, 4, 5] >>> a,*b,c = [1,2,3,4,5] >>> b [2, 3, 4

Re: String question

2008-06-24 Thread cokofreedom
On Jun 24, 5:38 am, "Mark Tolonen" <[EMAIL PROTECTED]> wrote: > "Andreu" <[EMAIL PROTECTED]> wrote in messagenews:[EMAIL PROTECTED] > > Yes, ... don't ask me why, but in fact v1,v2,v3 = str1.split() > > does not seem to work. My original problem was I forgot about > > the parenthesis as Tim point

Re: String question

2008-06-23 Thread Mark Tolonen
"Andreu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Yes, ... don't ask me why, but in fact v1,v2,v3 = str1.split() does not seem to work. My original problem was I forgot about the parenthesis as Tim point out. So I ended up converting to a list as in: v = str1.split() and acc

Re: String question

2008-06-23 Thread Andreu
Yes, ... don't ask me why, but in fact v1,v2,v3 = str1.split() does not seem to work. My original problem was I forgot about the parenthesis as Tim point out. So I ended up converting to a list as in: v = str1.split() and accessing the elements using v[0] v[1] ect...it is working now. Thanks. A

Re: String question

2008-06-23 Thread cokofreedom
On Jun 23, 4:45 pm, Andreu <[EMAIL PROTECTED]> wrote: > I want to split a sentence and assign each word to a variable. > In Ruby I can do it as: > > v1,v2,v3,v4,v5 = str1.split > > Which will be the Python equivalent ? Thanks. > > Andrew. Well a straight copy would be... >>> example = "Hello, how

Re: String question

2008-06-23 Thread Andreu
Wow...about ten seconds to get a kind response Thanks Tim. Andrew. Tim Golden wrote: Andreu wrote: I want to split a sentence and assign each word to a variable. In Ruby I can do it as: v1,v2,v3,v4,v5 = str1.split Which will be the Python equivalent ? Thanks. That would be: str1 = "T

Re: String question

2008-06-23 Thread Tim Golden
Andreu wrote: I want to split a sentence and assign each word to a variable. In Ruby I can do it as: v1,v2,v3,v4,v5 = str1.split Which will be the Python equivalent ? Thanks. That would be: str1 = "The quick brown fox jumps" v1, v2, v3, v4, v5 = str1.split () TJG -- http://mail.python.org/m

Re: String Question

2006-06-30 Thread Iain King
Tim Roberts wrote: > "Iain King" <[EMAIL PROTECTED]> wrote: > > > >You probably want: > > > >s.sendto('\xff'*6 + ('\x%s\x%s\x%s\x%s\x%s\x%s' % (str01, str02, str03, > > sttr04, str05, str06))*16, ('192.168.1.255', 80)) > > You probably should TRY suggestions before you post them. That will get an

Re: String Question

2006-06-30 Thread Tim Roberts
"Iain King" <[EMAIL PROTECTED]> wrote: > >You probably want: > >s.sendto('\xff'*6 + ('\x%s\x%s\x%s\x%s\x%s\x%s' % (str01, str02, str03, > sttr04, str05, str06))*16, ('192.168.1.255', 80)) You probably should TRY suggestions before you post them. That will get an "invalid \x escape". \x must be f

Re: String Question

2006-06-28 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > mac_string = '001485e55503' (This is the mac address of a computer.) > Since the MAC adddress are hexadecimal, how should I go about it here. > > Please help, every help is appreciated. Thanks I could not quite understand what you are trying to achieve, but it appears

Re: String Question

2006-06-28 Thread diffuser78
I will try this one too...thanks for your response. Iain King wrote: > [EMAIL PROTECTED] wrote: > > mac_string = '001485e55503' (This is the mac address of a computer.) > > > > I am using wake on LAN python script to start computer remote.It uses > > format like this > > > > s.sendto('\xff'*6

Re: String Question

2006-06-28 Thread diffuser78
Many Thanks!! It worked like a charm. Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > mac_string = '001485e55503' (This is the mac address of a computer.) > > > > I am using wake on LAN python script to start computer remote.It uses > > format like this > > > > s.sendto('\xff'*6 + '\x0

Re: String Question

2006-06-28 Thread Iain King
[EMAIL PROTECTED] wrote: > mac_string = '001485e55503' (This is the mac address of a computer.) > > I am using wake on LAN python script to start computer remote.It uses > format like this > > s.sendto('\xff'*6 + '\x00\x014\x85\xe5\x55\x03'*16, ('192.168.1.255', > 80)) > > where '\x00\x14\x8

Re: String Question

2006-06-28 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > mac_string = '001485e55503' (This is the mac address of a computer.) > > I am using wake on LAN python script to start computer remote.It uses > format like this > > s.sendto('\xff'*6 + '\x00\x014\x85\xe5\x55\x03'*16, ('192.168.1.255', > 80)) > > where '\x00\x14\x8

Re: String question - find all possible versions of a person's firstname

2006-01-11 Thread bonono
Nico Grubert wrote: > > This sounds like a homework problem. You might try splitting the name > > at the e's, check the length of the resulting list and do that many > > nested loops. > > This was my idea too but I am wondering if there are any scripts for > tasks like this. > > Nico def combine

Re: String question - find all possible versions of a person's firstname

2006-01-10 Thread Nico Grubert
> This sounds like a homework problem. You might try splitting the name > at the e's, check the length of the resulting list and do that many > nested loops. This was my idea too but I am wondering if there are any scripts for tasks like this. Nico -- http://mail.python.org/mailman/listinfo/py

Re: String question - find all possible versions of a person's firstname

2006-01-10 Thread Jeff Gercken
This sounds like a homework problem. You might try splitting the name at the e's, check the length of the resulting list and do that many nested loops. On 1/10/06, Nico Grubert <[EMAIL PROTECTED]> wrote: > Hi there, > > I have a string 'Michèle' that represents the firstname of a person. > > What