Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Strings
Index -> Programming, Python -> Python Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Alexmula




PostPosted: Thu Apr 16, 2009 8:38 pm   Post subject: RE:Strings

i use PyScripter. python version 2.6.
Sponsor
Sponsor
Sponsor
sponsor
Sniper4Life




PostPosted: Thu Apr 16, 2009 9:59 pm   Post subject: Re: RE:Strings

[quote="Alexmula @ Thu Apr 16, 2009 6:13 pm"]
Dusk Eagle @ Thu Apr 16, 2009 7:07 pm wrote:
Alexmula @ Thu Apr 16, 2009 7:55 pm wrote:
i believe this is what he means
Python:

name = raw_input("Enter name")
name = str(name)
splitName = name.split()
print splitName




that....is exactly what i mean
but when you split it...will it split it into 2 names?
???
Dusk Eagle




PostPosted: Thu Apr 16, 2009 10:01 pm   Post subject: Re: Strings

It will split into the number of spaces that are present in the string. You will have to do a bit of checking to ensure that there are exactly two words. You'll probably want to look into the len() function.
Sniper4Life




PostPosted: Thu Apr 16, 2009 10:05 pm   Post subject: RE:Strings

wow....i am so stupid...i tried thinking so hard i forgot how to do things the simple way...sigh...thanks
i can take it from here Very Happy
i just wanted to know how to split 2 words
thats it

(2 words with user's input )
btw thanks guys for helping out with this
i couldnt find the answer anywhere in google...and ive been stuck on it for a wile
i was thinking but i forgot to just toy around with random methods...thanks
Display posts from previous:   
   Index -> Programming, Python -> Python Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 19 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: