So I have three lists:
['this', 'is', 'the', 'first', 'list']
[1, 2, 3, 4, 5]
[0.01, 0.2, 0.3, 0.04, 0.05]
Is there a way that would allow me to print the values in these lists in order by index?
e.g.
this, 1, 0.01 (all items at list[0])
is, 2, 0.2 (all items at list[1])
the, 3, 0.3 (all items at list[2])
first, 4, 0.04 (all items ...
Is there a way to paste a block of code into IDLE? Pasting line by line works, but sometimes I'd like to paste many lines at once. When I try, IDLE reads the first line and ignores the rest.
>>> a = 1
b = 2
c = 3
>>>
>>> a
1
>>> b
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
b
NameError: name 'b' i...
Using Python V2.5.4, I am trying to create a Python dictionary from a stored list. This first method works
>>>myList=[]
>>>myList.append('Prop1')
>>>myList.append('Prop2')
>>>myDict = dict([myList])
However, the following method does not work
>>>myList2=['Prop1','Prop2','Prop3','Prop4']
>>>myDict2 = dict([myList2])
ValueError: dictio...
On Linux, YouTube places temporary flash files in /tmp. Nautilus can display the duration (Minutes:Seconds) of them, but I haven't found a way to extract the duration using python.'
The fewer dependencies your method requires the better.
Thanks in advance.
...
I am currently writing an RTS for pygame and have written a number of modules on top of pygame for common things, such as efficient collision detection, a state system and more featured sprites. Now while writing games, except for Rect and Surface, I barely write any calls to Pygame itself.
When Googling around on this, I have not fou...
I'm trying to manually set an object in the Django cache API but it fails (i think due to pickling?)
The object is given to me by a third party, my code is:
def index(request, template_name="mytemplate.htm"):
user_list = cache.get("user_list_ds")
if user_list is None:
# this is the expensive bit I'm trying to cache
...
Hi there,
I'm just getting started with ctypes and would like to use a C++ class that I have exported in a dll file from within python using ctypes.
So lets say my C++ code looks something like this:
class MyClass {
public:
int test();
...
I would know create a .dll file that contains this class and then load the .dll file in p...
I've been trying to find a postgres interface for python 2.x that supports real prepared statements, but can't seem to find anything. I don't want one that just escapes quotes in the params you pass in and then interpolates them into the query before executing it. Anyone have any suggestions?
...
Does anyone know of a automated GUI testing package for that works with PyQT besides Squish? Nothing against Squish I am just looking for other packages. It would be cool if there were an open source package. I am doing my testing under Linux.
...
In my efforts to resolve Python issue 1578269, I've been working on trying to resolve the target of a symlink in a robust way. I started by using GetFinalPathNameByHandle as recommended here on stackoverflow and by Microsoft, but it turns out that technique fails when the target is in use (such as with pagefile.sys).
So, I've written a ...
I want a 64-bit python interpreter on my Mac so I had to rebuild from source. However, with my own custom build interpreter I run into issues when I try to navigate when I run the interpreter from inside a shell. Typing python into the bash shell results in the familiar:
Python 2.6.3 (r263:75183, Oct 23 2009, 14:23:25)
[GCC 4.2.1 (Appl...
Hello,
I am looking for a way to extract an icon from a .exe file using Python. I know that you can use win32gui's ExtractIconEx function to grab the icon of a .exe but this returns a HIcon resource handle which is no good because I want to paint the icon using PyQt.
Also the only example I have seen using win32gui does not have any tr...
I am trying to position two subplots next to each other (as opposed to under each other). I am expecting to see [sp1] [sp2]
Instead, only the second plot [sp2] is getting displayed.
from matplotlib import pyplot
x = [0, 1, 2]
pyplot.figure()
# sp1
pyplot.subplot(211)
pyplot.bar(x, x)
# sp2
pyplot.subplot(221)
pyplot.plot(x, x)
pyp...
I'd rather not use Macports. Simply cause Macport replaces (installs another Apache in /opt/local/bin) the default installation of Apache. And that would mean having ports install/replace PHP too. I'd rather use the default installation included in Snow Leopard.
Been searching the net, and all I get is old instructions using Darwin Port...
I'm trying to write a font viewer for TrueType / OpenType fonts with VB6 / VB5 code (under Windows).
it is surprisingly difficult:
1) in VB / winAPI, i did not find how to extract the font's name, or font properties in general.
2) i can install the font (using AddFontResource API function), but then have to uninstall it. However, whil...
I've tried using:
win.configure(stack_mode=X.TopIf)
win.set_input_focus(X.RevertToParent, X.CurrentTime)
However even without any focus loss prevention on my window manager this does not work, does anyone know of another way to do this? Xlib or not.
...
I am trying to remove a certain color from my image however it's not working as well as I'd hoped. I tried to do the same thing as seen here http://stackoverflow.com/questions/765736/using-pil-to-make-all-white-pixels-transparent however the image quality is a bit lossy so it leaves a little ghost of odd colored pixels around where what ...
What are some 'good', non-trivial Pygame tutorials?
I realize good is relative. As an example, a good one (to me) is the one that describes how to use pygame.camera. It's
recent
uses a modern PyGame (1.9)
non-trivial, in that it shows how to use it the module for a real application.
I'd like to find others. A lot of the ones on ...
Just a beginner with the python/postgres combo so forgive me if this is trivial. I'm executing a raw SQL query with sqlalchemy along the lines of:
SELECT * FROM table WHERE pk_table_id IN ()
For the example below I tried self.ids as a tuple containing string or integers as well as an array containing string or integers. Either way i...
Ordered dictionaries are extremely useful structures, but unfortunately these are quite recent only working in versions from 3.1 and 2.7. How can I use an ordered dictionary in older versions?
...