Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. **************************************************************** Personal firewall software may warn about the connection IDLE makes to its subprocess using this computer's internal loopback interface. This connection is not visible on any external interface and no data is sent to or received from the Internet. **************************************************************** IDLE 2.6.6 >>> import urllib >>> urllib >>> page_handle = urllib.urlopen('http://jadrian.org') >>> text = page_handle.read() >>> text '\n\n\n\nJadrian Miles\n\n\n\n
\n

Hi, I\'m Jadrian Miles.

\n \n
\n

I am a seventh-year PhD candidate in the\nBrown University\nComputer Science Department.\nI do research in medical imaging,\nspecifically finding models and metrics for diffusion\nMR imaging of the human brain.\nMy background is in math and visual art\nin addition to computer science.

\n\n

Latest:\nPredicting DTI Tractography Uncertainty from Diffusion-Weighted-Image Noise, with David H. Laidlaw, in ISMRM 2012.\n

\n
\n \n\n
\n \n\n\n\n' >>> page_handle.close() >>> print(text) Jadrian Miles

Hi, I'm Jadrian Miles.

I am a seventh-year PhD candidate in the Brown University Computer Science Department. I do research in medical imaging, specifically finding models and metrics for diffusion MR imaging of the human brain. My background is in math and visual art in addition to computer science.

Latest: Predicting DTI Tractography Uncertainty from Diffusion-Weighted-Image Noise, with David H. Laidlaw, in ISMRM 2012.

>>> target = 'brain' >>> text.find(target) 774 >>> text[774:784] 'brain.\nMy ' >>> text.find(target, 775) -1 >>> target = 'Computer' >>> firstOccurrence = text.find(target) >>> firstOccurrence 601 >>> text[590:620] 'brown.edu">Computer Science De' >>> secondOccurrence = text.find(target, firstOccurrence + len(target)) >>> secondOccurrence 1237 >>> text[1210:1260] 'v id="right">\n

Box 1910, Computer Science Dept.<' >>> >>> >>> >>> sentence = "Mary while John had had had had had had had." >>> words = sentence.split() >>> words ['Mary', 'while', 'John', 'had', 'had', 'had', 'had', 'had', 'had', 'had.'] >>> '---'.join(words) 'Mary---while---John---had---had---had---had---had---had---had.' >>> for word in words: print(word) Mary while John had had had had had had had. >>> print('\n'.join(words)) Mary while John had had had had had had had. >>>