Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8374341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:54:08+00:00 2026-06-09T14:54:08+00:00

I just wrote a script that is meant to go through the alphabet and

  • 0

I just wrote a script that is meant to go through the alphabet and find all unclaimed four-letter twitter names (really just for practice as I’m new to Python). I have written a couple previous scripts that use ‘urllib2’ to get website html from a url, but this time it doesn’t appear to be working. Here is my script:

import urllib2

src=''
url=''
print "finding four-letter @usernames on twitter..."
d_one=''
d_two=''
d_three=''
d_four=''
n_one=0
n_two=0
n_three=0
n_four=0
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

while (n_one > 26):
    while(n_two > 26):
        while (n_three > 26):
            while (n_four > 26):
                d_one=letters[n_one]
                d_two=letters[n_two]
                d_three=letters[n_three]
                d_four=letters[n_four]
                url = "twitter.com/" + d_one + d_two + d_three + d_four

                src=urllib2.urlopen(url)
                src=src.read()
                if (src.find('Sorry, that page doesn’t exist!') >= 0):
                    print "nope"
                    n_four+=1
                else:
                    print url
                    n_four+=1
            n_three+=1
            n_four=0
        n_two+=1
        n_three=0
        n_four=0
    n_one+=1    
    n_two=0
    n_three=0
    n_four=0

Running this code returned the following error:

SyntaxError: Non-ASCII character ‘\xe2’ in file name.py on line 29,
but no encoding declared; see http://www.python.org/peps/pep-0263.html
for details

and after visiting that link and doing some additional searching, I added the following line to the top of the document:

# coding: utf-8

Now, while it no longer returns an error, nothing appears to be happening. I added the line

print src

which should have printed the html of each url, but nothing happened when I ran it. Any advice would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:54:09+00:00Added an answer on June 9, 2026 at 2:54 pm

    Well, you initialise n_one=0, and then do a loop while (n_one > 26). When Python first encounters it, it sees while (0 > 26) which is obviously false and it therefore skips the entire loop.

    And as gnibbler’s answer tells you, there are cleaner ways of doing the loop anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just wrote a PHP login script, and what I'm trying to accomplish is
I just wrote a very simple perl tk script to read a huge text
I just started playing with Clojure, and I wrote a small script to help
I'm just beginning to learn python. I wrote an example script to test OOP
I'm writing a script that's meant to be embedded on 3rd party sites to
I have a django app and I wrote a fabric script that installs my
I'm going through Bitbucket and I can't seem to find any Mercurial repositories that
I wrote a bash script that fetches lyrics from a website. The script is
I wrote a script that points to my QA environment URL; it works great.
I'm trying to write a very lightweight build script which will basically just get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.