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
<module 'urllib' from 'C:\Python26\lib\urllib.pyc'>
>>> page_handle = urllib.urlopen('http://jadrian.org')
>>> text = page_handle.read()
>>> text
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n<title>Jadrian Miles</title>\n<link rel="stylesheet" type="text/css" href="front.css" />\n</head>\n<body>\n<div id="container">\n<h1>Hi, I\'m Jadrian Miles.</h1>\n        <!-- ========== LEFT ========== -->\n<div id="left">\n<p>I am a seventh-year PhD candidate in the\n<a href="http://www.brown.edu">Brown University</a>\n<a href="http://cs.brown.edu">Computer Science Department</a>.\nI do <a href="research.html">research</a> in medical imaging,\nspecifically finding models and metrics for diffusion\nMR imaging of the human brain.\nMy <a href="bio.html">background</a> is in math and visual art\nin addition to computer science.</p>\n\n<p><a href="docs/papers">Latest</a>:\n<a href="docs/papers/2012%20-%20Miles%20-%20ISMRM%20-%20Streamline%20Uncertainty%20%28abstract%29.pdf">Predicting DTI Tractography Uncertainty from Diffusion-Weighted-Image Noise</a>, with David H. Laidlaw, in <em>ISMRM 2012</em>.\n</p>\n</div>\n        <!-- ========== RIGHT ========== -->\n<div id="right">\n<p>Box 1910, Computer Science Dept.<br />\nBrown University<br />\nProvidence, RI 02912</p>\n<p>jadri&#97;n&#64;&#99;&#115;&#46;brown&#46;edu</p>\n</div>\n</div>\n        <!-- ========== FOOTER ========== -->\n<div id="footer">\n<ul class="PipeSeparatedList">\n    <li><a href="bio.html">Bio</a></li>\n    <li><a href="research.html">Research</a></li>\n    <li><a href="docs/papers">Papers</a></li>\n    <li><a href="courselist.html">Courses</a></li>\n    <li><a href="docs/etc/art/index.html">Art</a></li>\n    <li><a href="docs/etc/index.html">Etc.</a></li>\n    <li><a href="docs/resume.html#cv">CV</a></li>\n    <li><a href="docs/resume.html">Resum&eacute;</a></li>\n</ul>\n</div>\n</body>\n</html>\n'
>>> page_handle.close()
>>> print(text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Jadrian Miles</title>
<link rel="stylesheet" type="text/css" href="front.css" />
</head>
<body>
<div id="container">
<h1>Hi, I'm Jadrian Miles.</h1>
        <!-- ========== LEFT ========== -->
<div id="left">
<p>I am a seventh-year PhD candidate in the
<a href="http://www.brown.edu">Brown University</a>
<a href="http://cs.brown.edu">Computer Science Department</a>.
I do <a href="research.html">research</a> in medical imaging,
specifically finding models and metrics for diffusion
MR imaging of the human brain.
My <a href="bio.html">background</a> is in math and visual art
in addition to computer science.</p>

<p><a href="docs/papers">Latest</a>:
<a href="docs/papers/2012%20-%20Miles%20-%20ISMRM%20-%20Streamline%20Uncertainty%20%28abstract%29.pdf">Predicting DTI Tractography Uncertainty from Diffusion-Weighted-Image Noise</a>, with David H. Laidlaw, in <em>ISMRM 2012</em>.
</p>
</div>
        <!-- ========== RIGHT ========== -->
<div id="right">
<p>Box 1910, Computer Science Dept.<br />
Brown University<br />
Providence, RI 02912</p>
<p>jadri&#97;n&#64;&#99;&#115;&#46;brown&#46;edu</p>
</div>
</div>
        <!-- ========== FOOTER ========== -->
<div id="footer">
<ul class="PipeSeparatedList">
    <li><a href="bio.html">Bio</a></li>
    <li><a href="research.html">Research</a></li>
    <li><a href="docs/papers">Papers</a></li>
    <li><a href="courselist.html">Courses</a></li>
    <li><a href="docs/etc/art/index.html">Art</a></li>
    <li><a href="docs/etc/index.html">Etc.</a></li>
    <li><a href="docs/resume.html#cv">CV</a></li>
    <li><a href="docs/resume.html">Resum&eacute;</a></li>
</ul>
</div>
</body>
</html>

>>> 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<p>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.
>>> 
