15,190 Topics

Member Avatar for
Member Avatar for vegaseat
Member Avatar for dashing.adamhughes
2
7K
Member Avatar for vegaseat
3
343
Member Avatar for vegaseat

This snippet shows you how to create a list of class instances. The class itself cannot be pickled, but the list of instances can. To use the pickled data file in another program, you have to recode the class in that program.

3
2K
Member Avatar for biscayne

My code has a couple of "multiple assigments" and somehow I think there should be a nicer way to do this in Python. This is how it currently looks like: # sum price fields paf = paf + float(pa) pbf = pbf + float(pb) pcf = pcf + float(pc) pdf …

Member Avatar for biscayne
0
248
Member Avatar for vegaseat

Jython is a version of Python that can use the extensive Java library. Jython uses Python syntax and avoids the rather ugly syntax (at least for Pythonions) of Java. Here we apply it to bring up an image from a file.

4
713
Member Avatar for smitmail22

Why does the function *def human_move(board, human)* need to receive board *and* human? won't it work the same if it just receives board? *def human_move(board)* # global constants X = "X" O = "O" EMPTY = " " TIE = "TIE" NUM_SQUARES = 9 def display_instruct(): """ Display game instructions. …

Member Avatar for smitmail22
0
206
Member Avatar for krystosan

I was experimenting with special methods, so I tried to create my own `__new__` method , well just as expected it got called when the object was instantiated but the window that should show up didnt show even when i used super to retain the original `__new__ `functionality. from PySide.QtCore …

0
63
Member Avatar for thanadaray

At first, I have "C:/test02.txt" too good positive a film for stunt scheduling i think objective My codes with open('C:/test01.txt') as words: ws = words.read().splitlines() with open('C:/test02.txt') as file_modify4: for x in file_modify4: sx = map(str.strip, x.split("\t")) ssx = sx[0].split(" ") ## list for w in ssx: if w in …

Member Avatar for Lucaci Andrew
0
129
Member Avatar for krystosan
Member Avatar for Ron12345

I have a web app in python but I'd like to protect it with site minder authentication. Thanks.

0
112
Member Avatar for woooee

Hi Guys, Please be gentle with me as im a complete n00b. My favorite language is actually Java which im learning at Uni at the moment. However to throw a spanner in the works they have switched us over to Python, as well as learning Java. My mind has been …

Member Avatar for Lardmeister
1
171
Member Avatar for ronbarak

When I try to save a pylab plot (either from the GUI or with `pylab.savefig`), I get the error at the bottom. A minimal script that demonstrates the problem is: import pylab pylab.savefig("foo.png") A Google search for `IndexError: Unexpected SeqBase<T> length` did produce some results, none of them hinting how …

0
146
Member Avatar for GGreek

I've created this script that logs in to Windows Live (http://login.live.com/) but I can't tell if it works, can anyone elaborate? import requests import sys EMAIL = 'email goes here' PASSWORD = 'pass goes here' URL = 'https://login.live.com/' def main(): # Start a session so we can have persistant cookies …

0
113
Member Avatar for GGreek

import requests import sys EMAIL = 'YOUR EMAIL GOES HERE' PASSWORD = 'YOUR PASSWORD GOES HERE' URL = 'https://login.live.com/' def main(): # Start a session so we can have persistant cookies session = requests.Session() # This is the form data that the page sends when logging in login_data = { …

0
49
Member Avatar for nnekymoe

![Spatial_Recall_2](/attachments/large/4/Spatial_Recall_2.png "Spatial_Recall_2") I'm new to pygame and currently I'm working on creating a memory game where the computer displays boxes at random positions for like a second and then the user has to click on where he/she thinks those boxes are. It's kind of like this: [Click Here](http://www.lumosity.com/brain-games/memory-games/memory-matrix) However right …

0
168
Member Avatar for neely615

I am in the process of learning python, but I have a problem some one gave me last week that I wouldn't mind solving before I get to where I actually learn about it. I think python is the best choice. I need to generate a txt file by inserting …

Member Avatar for neely615
0
172
Member Avatar for LinaClark

I have finished the code, but I can not for the life of me figure out why I am not getting any output. Any help would most appreciated. #!/usr/bin/python import apsw import random class NonRepeatingRandom(object): def __init__(self, maxvalue): self.maxvalue = maxvalue self.used = set() def next(self): if len(self.used) >= self.maxvalue: …

Member Avatar for Gribouillis
0
231
Member Avatar for TrustyTony

This example program of using the multiprocessing is crashing my i7 4 core windows7 64 bit computer (32 bit enthought Python 2.7), but is running fine in virtual machine Ubuntu with 4 cores assigned. Can anyone run it in their commputer in Windows7. My system memory (8 GB) is totally …

Member Avatar for vegaseat
0
255
Member Avatar for dilbert_here00

Hello All, I am trying to access files which are on a shared network file system, but not sure which python API I should be using. Description: For example the IP address of the file system is 10.10.10.1 1. From windows if i want to access this server i simply …

Member Avatar for Gribouillis
0
469
Member Avatar for ZZucker

Santa just brought me a fancy notebook computer and I want to know if anyone has some experiemce with accessing that little camera with Python code?

Member Avatar for ZZucker
0
217
Member Avatar for jimmyshote

anytime i add a directory in a .pth file of my c:\python30\Lib\site-packages folder on windows and i try to import from the listed directory in my .pth files, i get an import error that the module does not exist and after importing sys on the windows command line interface and …

Member Avatar for ZZucker
0
547
Member Avatar for Jacklittle01

Hi guys, I am working on a text based adventure game in Python and I am constantly getting this error: **There's an error in your program: return outside function(g.py, line 179** Here is the code http://www.mediafire.com/?4ga0weu4ifc6s1u

Member Avatar for james.lu.75491856
0
185
Member Avatar for wwielen

Hi, I'm trying to make a slider, but for some reason all the numbers of the slider get in left corner of the frame, all at the same position(instead of the 1;left,the position of the slider;middle and 100; right). Also see added File Here is my code: import wx class …

Member Avatar for wwielen
0
139
Member Avatar for Arizona33

Hello, I am a new to python. I need to solve 5 exercises. Any help would be very much appreciated!! thank you! 1.Write a program dotplot.py That takes as input a fasta file with two sequences A scoring matrix and sliding window, such as: dotplot.py fasta.in score.mat 11 and prints …

Member Avatar for vegaseat
-1
136
Member Avatar for giancan

Dear Friends, I have a sequence of two values as the following: 00001.doc d:\pathtofile\image50.jpg 00002.doc d:\pathtofile\image38.jpg 00003.doc d:\pathtofile\image40.jpg ... I would like to add the values to a list, sort the list by second value and rename the first value accordingly. For example, the following steps: Step 1 '00002.doc', 'd:\pathtofile\image38.jpg' …

Member Avatar for vegaseat
0
184
Member Avatar for felix001

What is the best way to use a dictionary within a class. Do I have to assign the dict within the class ? Thanks

Member Avatar for vegaseat
0
120
Member Avatar for mgunia

Hello Everyone! I am a beginner user of Python without IT background (I am interested in IT developing my knowledge step by step). So far I did simple scripts in Python and I encountered a problem. I was looking on Google, however I didn't find the satisfactory answers which would …

Member Avatar for vegaseat
0
9K
Member Avatar for Niner710

I have a question on how to slice a dataframe. Below is a row in my dataframe. I just want to get the list under column C. I saw that I could use df.get_value(), but I'm not sure what to put for index. Is this the right way to return …

0
54
Member Avatar for LinaClark

I need help figuring out how to fix my code. Every time I run the code its traceback is to this part of it. My code is Unbound Local Error for 'result'. Please see code below: def Level1(self): sql = "SELECT easyhint, gps, qrcode FROM gamedb WHERE quad = 1 …

Member Avatar for scaba
0
170
Member Avatar for james.lu.75491856

Traceback (most recent call last): File "C:/python files/USACO/crazy/crazy.py", line 87, in <module> grid.plot(x,y,"F") File "C:/python files/USACO/crazy\grid.py", line 63, in plot self.g[(x,y)] = replace TypeError: unhashable type: 'list' You see, I'm hashing a string with the key bing a tuple. This is using my own 2d grid data structure.

Member Avatar for james.lu.75491856
0
585

The End.