question1=input("What is" + name+"'s" + "favorite number?")
question2=input("What is" + name+"'s" + "favorite Letter?")
question3=input("What is" + name+"'s" + "favorite age?")
question4=input("What is" + name+"'s" + "favorite video system?")
question5=input("What is" + name+"'s" + "favorite color?")
question6=input("What is" + name+"'...
I am trying to use the Universal Encoding Detector (chardet) in Python to detect the most probable character encoding in a text file ('infile') and use that in further processing.
While chardet is designed primarily for detecting the character encoding of webpages, I have found an example of it being used on individual text files.
Howe...
In C, long is 64 bit on a 64 bit system. Is this reflected in Python's ctypes module?
...
Hi here's my code:
keywords_list = """
cow
dog
cat
"""
keywords_list = [i.strip() for i in keywords_list.split("\n") if i]
I'm still getting an empty element(last element) and I'm wondering why. Also suggestions to improve my code would be appreciated.
Thanks in advance!
edit:
solved it myself by stripping the string first but I'm ...
I am trying to develop a Recursive Extractor. The problem is , it is Recursing Too Much (Evertime it found an archive type) and taking a performance hit.
So how can i improve below code?
My Idea 1:
Get the 'Dict' of direcories first , together with file types.Filetypes as Keys. Extract the file types. When an Archive is found Extract ...
For some reason whenever i run a query on the db cursor, it generates two errors in its .messages list, is this a feature?
here is the code that runs the query, all the application does is open a connection to the db, run this once with a forced error, read the .messages, then exit
import MySQLdb
class dbobject:
def __init__(self,...
Hi! I was happily using BeautifulSoup and I'm also using a text file as input parameters of my Python script.
I then came across the famous "UnicodeEncodeError" error.
I've been reading questions here at SO but I'm still confused.
What does ASCII got to do with all of these?
What encoding do I use on my text editor (Notepad++)? ANSI? ...
Hi, I'm a java developer/python beginner, and I'm missing my maven features, particularly dependency management and build automation (I mean you don't build, but how to create a package for deployment?)
Is there a python equivalent to achieve these features?
Note: I use python 2.x
Thanks.
...
I bought a blank DVD to record my favorite TV show. It came with 20 digit stickers. 2 of each of '0'-'9'.
I thought it would be a good idea to numerically label my new DVD collection. I taped the '1' sticker on my first recorded DVD and put the 19 leftover stickers in a drawer.
The next day I bought another blank DVD (receiving 20 new st...
class A(object):
def __init__(self):
self.db = create_db_object()
def change_Db_a(self):
self.db.change_something()
self.db.save()
def change_db_b(self):
self.db.change_anotherthing()
self.db.save()
I am getting object from database, I changing it in multiple function and saving...
I am writing a desktop usage statistics app. It runs a background daemon which wakes up at regular intervals, finds the name of the application window currently in focus and logs that data in database.
I manage to do this on Linux desktop with help of xprop utility (you can find it here).
How can I do the same on Mac OSX? Is there a d...
I am working with a Macbook programming python. What I want to know is how I can access certain files using Python's file functions. A google search failed me.
For example, Windows would be something like this:
f = open(r'C:\text\somefile.txt')
How would I access something from a folder saved on the Desktop of a Mac?
...
I am compiling on Ubuntu 10.04 LTS. The Perforce Python API uses their C++ API for some of it. So, I point the setup.py at the C++'s API directory using the --apidir= they say to use. When it starts to compile the C++, I get a whole load of errors. Here is the error list... http://pastebin.ca/1907389 ...But anyway, no one else has had th...
I'm sorry if my title is a little unclear. Basically I want to print a '.' every second for five seconds then execute a chunk of code. Here is what I tried:
for iteration in range(5) :
timer = threading.Timer(1.0, print_dot)
timer.start()
#Code chunk
It seems as though that Timer starts its own thread for every instance, so th...
Hi,
I have one xml file.
<Item>Item value</Item>
<Itemdate>24/07/2010</Itemdate>
<Total>1</Total>
<Itemcategory>Income</Itemcategory>
<GroupName>Salary</GroupName>
<EditId>undefined</EditId>
<Item>Item value</Item>
<Itemdate>24/07/2010</Itemdate>
<Total>1</Total>
<Itemcategory>Income</Itemcategory>
<GroupName>Salary</GroupNam...
HellO Everyone,
I have couple of ideas in my brain which i would like to bring out before its too late. Basically i want to develop a web application which i could sell it to clients. So which technology shall i use to accomplish this. I have been a C and C++ software developer but its been a very long time since i have developed one. S...
I'm coming from a C++ background to python
I have been declaring member variables and setting them in a C++esqe way like so:
class MyClass:
my_member = []
def __init__(self,arg_my_member):
self.my_member = arg_my_member
Then I noticed in some open source code, that the initial declaration my_member = [] was completel...
In django, I have a table of people, each of which has a namefirst and namelast.
I want to do the sql:
select * from names where left(namefirst,1)=left(namelast,1).
Right now my best effort is
qs=People.objects.extra(select={'db':'select left(namefirst,1)=left(namelast,1)'})
but then if i stick a .filter(db=1) on that it genera...
How can I send an email to admin when a 500 error occurs, in python.
The web framework I'm using is 'bottle'.
...
I'm building a DSL for form validation in Python, and one of the requirements is to be able to specify that a field should be greater than or less than a constant or another field value. As a result, I'm trying to easily map operators like <, >, <= and >= to their equivalent functions in the operator module, so that they can be called du...