[Tutor] String method "strip()" not working
I am trying to learn how to use strip() method. It is supposed to cut out all the whitespace as I read in the tutorial. But the code is not working. Here's my code: sentence = "Hello, how are you?" > > >> print(sentence) > > >> print(sentence.strip()) > > >> input("\n\nPress enter key to exit.") > > > Here's it's output: Hello, how are you? > Hello, how are you? > > Press enter key to exit. > Both results are same. P.S.: I am using Python 3.1 IDLE on Windows 7. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Beautiful Soup
On 11/30/06, Shitiz Bansal <[EMAIL PROTECTED]> wrote: > I am using beautiful soup for extracting links from a web page. > Most pages use relative links in their pages which is causing a problem. Is > there any library to extract complete links or do i have to parse this > myself? > Beautiful Soup can also extract text which is present on the page. If there are no complete links no library can do that for you. But since you are reaching a certain web page to extract you already have that URL information with you. All you have to do then is to prefix it to each extracted URL. HTH akash ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How do I make Python read a string character by character?
On 8/24/06, Nathan Pinno <[EMAIL PROTECTED]> wrote: > How do I make Python read a string character by character? >>> str = 'string' >>> for i in range(0, len(str)): ... print str[i] ... s t r i n g just take care about the indentation. -- regards akash ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor