I have a small lightweight application that is used as part of a larger solution. Currently it is written in C but I am looking to rewrite it using a cross-platform scripting language. The solution needs to run on Windows, Linux, Solaris, AIX and HP-UX.
The existing C application works fine but I want to have a single script I can maint...
Hi,
I'm trying to open a file and afterwards create a list with each line read from the file.
i=0
List=[""]
for Line in inFile:
List[i]=Line.split(",")
i+=1
print List
But this sample code give me an error because of the i+=1 saying that index out of range.
What's my prblem here? How can I write the code in or...
Can someone give me some example code that creates a surface with a transparent background in pygame?
...
Let's say you have a two dimensional plane with 2 points (called a and b) on it represented by an x integer and a y integer for each point.
How can you determine if another point c is on the line segment defined by a and b?
I use python most, but examples in any language would be helpful.
...
I'd like to extract the text from an HTML file using Python. I want essentially the same output I would get if I copied the text from a browser and pasted it into notepad.
I'd like something more robust than using regular expressions that may fail on poorly formed HTML. I've seen many people recommend Beautiful Soup, but I've had a ...
How can I tell when Windows is changing a monitors power state?
...
How can I send a monitor into/out-of a different power state (like sleep)?
...
Hey everyone,
I'm thinking how to arrange a deployed python application which will have a
Executable script located in /usr/bin/ which will provide a CLI to functionality implemented in
A library installed to wherever the current site-packages directory is.
Now, currently, I have the following directory structure in my sources:
fo...
I'm a long time C++/Java developer trying to get into Python and am looking for the stereotypical "Python for C++ Developers" article, but coming up blank. I've seen these sort of things for C#, Java, etc, and they're incredibly useful for getting up to speed on language features and noteworthy differences. Anyone have any references?
...
The curses.ascii module has some nice functions defined, that allow for example to recognize which characters are printable (curses.ascii.isprint(ch)).
But, diffrent character codes can be printable depending on which locale setting is being used. For example, there are certain polish characters:
>>> ord('a')
97
>>> ord('ą')
177
>>>
...
With a class in python, how do i define a function to print every single instance of the class in a format defined in the function.
...
Is there any lib that convert very long numbers to string just copying the data?
These one-liners are too slow:
def xlong(s):
return sum([ord(c) << e*8 for e,c in enumerate(s)])
def xstr(x):
return chr(x&255) + xstr(x >> 8) if x else ''
print xlong('abcd'*1024) % 666
print xstr(13**666)
...
Hi All,
Can anyone help me to get info about the Scoping issue( Static and dynamic scoping) in Python ?
Thanks
...
From this question and my own benchmarks it seems that the marshal module is about 20-30x faster than cPickle. Why is this so? What functionality does cPickle offer over marshal that justifies this? (Another way of putting it - why not always use marshal? Why do both of these modules exist?)
...
Has anybody seen such a thing? Small self-sufficient modules are preferred.
...
I've recently started with Python, and am enjoying the "batteries included" design. I'e already found out I can import time, math, re, urllib, but don't know how to know that something is builtin rather than writing it from scratch.
What's included, and where can I get other good quality libraries from?
...
I'm an accomplished web and database developer, and I'm interested in redesigning my own website.
I have the following content goals:
Support a book I'm writing
Move my blog to my own site (from blogger.com)
Publish my articles (more persistent content than a blog)
Host a forum with light use
Embed slide sharing and screencasts
I ...
Basically, I would like to build a list comprehension over the "cartesian product" of two iterators. Think about the following Haskell code:
[(i,j) | i <- [1,2], j <- [1..4]]
which yields
[(1,1),(1,2),(1,3),(1,4),(2,1),(2,2),(2,3),(2,4)]
Can I obtain a similar behavior in Python in a concise way?
...
First, context: I'm trying to create a command-line-based tool (Linux) that
requires login. Accounts on this tool have nothing to do with
system-level accounts -- none of this looks at /etc/passwd.
I am planning to store user accounts in a text file using the same format (roughly) as /etc/passwd.
Despite not using the system-level pass...
I would like to know the best way to replace a standard textarea field with a rich text editor in Django Admin?
...