Python : Check an inputs first characters
<p>Okay so i have a problem i looked it up but didnt know exactly what to look up and kept seeing problems that had nothing to do with mine.. So my problem here is im taking an input in python</p>

<pre><code>flashSite = raw_input('[?] Please Provide a Web Url : ')
</code></pre>

<p>After it takes the input i want it to check if the http:// characters are included in the beginning of the input , if they are then dont add them in again , if they arent then add them in for the user , Help is greatly appreciated.. Also im new to Stackoverflow so i will have problems with little things like putting code in comments and such:(</p>

<p>edit :
So from other answers and comments i came out with this</p>

<pre><code>def ScrapeFlashFiles():
flashSite = raw_input('Please Provide a web URL : ')
if flashSite.lower().startswith(flashSite, beg=0, end=7('http://')):
    return flashSite
elif flashSite.lower().startswith(flashSite, beg=0, end=4('www.')):
    flashSite = 'http://' + flashSite
print ' Sending requests... '
flashReq = requests.get(flashSite)
print ' Scraping content '
flashTree = html.fromstring(flashReq.content)
print 'Searching for keyword \'.swf\' '
for line in flashReq.content.split('\n'):
    if '.swf' in line:
        print line
print 'Flash Scrape Complete..'
</code></pre>

<p>Am i doing something wrong here?</p>

<p>Note i am a beginner.. Im getting an error now talking about an int..</p>

<p>Source to where i was reading about the startswith method
<a href="https://www.tutorialspoint.com/python/string_startswith.htm" rel="nofollow">https://www.tutorialspoint.com/python/string_startswith.htm</a></p>

<p>raw_input returns a string, as visible from the documentation: <a href="https://docs.python.org/2/library/functions.html#" rel="nofollow">https://docs.python.org/2/library/functions.html#</a></p>

<p>Since you're working with a string Type, you can use any of the string methods <a href="https://docs.python.org/2/library/stdtypes.html#string-methods" rel="nofollow">https://docs.python.org/2/library/stdtypes.html#string-methods</a>.</p>

<p>For example:</p>

<pre><code>expected_beginning = 'http://'
if not flashSite.startswith(expected_beginning):
  flashSite = expected_beginning + flashSite
</code></pre>

<p>You could do interesting things, like make sure it's always lowercase by doing:</p>

<pre><code>if not flashSite.lower().startswith(expected_beginning):
</code></pre>

<p>etc.</p>

python input character