“NameError: name ” is not defined” after user input in Python

I’m completely lost as to why this isn’t working. Should work precisely, right? UserName = input("Please enter your name: ") print ("Hello Mr. " + UserName) raw_input("<Press Enter to quit.>") I get this exception: Traceback (most recent call last): File "Test1.py", line 1, in <module> UserName = input("Please enter your name: ") File "<string>", line … Read more

How can I remove the ANSI escape sequences from a string in python

Here is a snippet that includes my string. 'lsrnx1b[00mx1b[01;31mexamplefile.zipx1b[00mrnx1b[01;31m' The string was returned from an SSH command that I executed. I can’t use the string in its current state because it contains ANSI standardized escape sequences. How can I programmatically remove the escape sequences so that the only part of the string remaining is ‘examplefile.zip’. … Read more

BeautifulSoup Grab Visible Webpage Text

Basically, I want to use BeautifulSoup to grab strictly the visible text on a webpage. For instance, this webpage is my test case. And I mainly want to just get the body text (article) and maybe even a few tab names here and there. I have tried the suggestion in this SO question that returns lots of <script> tags and html comments which I don’t want. I can’t figure out the arguments I need for the function findAll() in order to just get the visible texts on a webpage.