14,968 Topics

Member Avatar for
Member Avatar for zpzp16

I want to do x=[1,2,3,1,1,2,] y=[1,2] x-y=[3] but when I write z=[set(x)-set(y)] if gave: z=[1,1,2,3] how I can do it?

Member Avatar for woooee
0
141
Member Avatar for JoshuaBurleson
Member Avatar for JoshuaBurleson
0
222
Member Avatar for JoshuaBurleson

In one of the books I'm using to study Python I keep seeing things like: [CODE] class Application(Frame): super(Application, self).__init__(master): self.grid() self.bttn_clicks=0 self.create_widget"""which is another function in the class"""[/CODE] Why is the super necessary for the class if the class it's calling is itself?

Member Avatar for JoshuaBurleson
0
256
Member Avatar for Simplicity.

Dear Folks, When I iterate within the very bottom function under the comment "#Update conserved quantities" in this module using for loop (see below), I have noticed that the block of statements below it is not iterated, [CODE] """ """ from numpy import * from math import * from scitools.std …

Member Avatar for Simplicity.
0
3K
Member Avatar for hughesadam_87

Hey everyone, I've tried extensively to find a thread like this already, so I hope it's not a repose. Basically, I have a program with a nice GUI (Tkinter) which has a frame which takes in matplotlib figures. I am able to connect the plots to the Tkinter frame this …

Member Avatar for hughesadam_87
0
379
Member Avatar for [V]

I have a very strange problem. I have a python script that uses multi-threading. It works fine, and does exactly what it should. I use several modules that interact with other files. All file handles are closed as soon as they are on longer needed. When I run this script …

Member Avatar for Gribouillis
0
168
Member Avatar for Thropian

So I've decided to make some simple animations with python and I came to the issue of getting parts to rotate and move together. I decided to put parts together on a smaller canvas (canvas for the leg placed on the main canvas) but I can't get the canvas to …

Member Avatar for TrustyTony
0
1K
Member Avatar for kayoh

Hey guys, Just as the title says, I want to implement using an excel spreadsheet as an argument for a python script. I already have the layout of the spreadsheet, but I want to be able to assign the variables in my python script from specific cells of the spreadsheet. …

Member Avatar for Gribouillis
0
1K
Member Avatar for Cheerios

Hello All, Its been a week since I started learning Python, and its been wonderful. This is the problem I am trying to solve. There are 20 text files (In1.txt, In2.txt,....,In20.txt) in a folder. Each text file has 150000 rows. Each of the 150000 rows has a vector of float …

Member Avatar for TrustyTony
0
208
Member Avatar for SpiritualMadMan

Honestly, I am not quite sure how to explain this... I have a 24 Line GUI wxPython Class that has no Events and Two Functions... These Functions are: Clear the Display and Add a Line from the Bottom. I want to use this Frame from beginning to end of the …

0
62
Member Avatar for aragonnette

[CODE]import os import urllib from datetime import datetime import workerpool class DownloadJob(workerpool.Job): def __init__(self, fa): self.fa = fa def run(self): f = open(self.fa + '.txt','w') f.write('Example Note.......') f.close() pool = workerpool.WorkerPool(size=5) def workfile(): range1 = 51 range2 = 102 fam1 = 555 fam2 = 833 ranges = range2 -range1 fams …

Member Avatar for aragonnette
0
211
Member Avatar for g_amanu

i have a folder that contains csv excel files that have numbers in the first column labeled 'x', second column label'y', and third column labeled'z'. i was trying to take all of the numbers in the x and calculate the averages and std, take all the numbers in the y …

Member Avatar for g_amanu
0
7K
Member Avatar for SpiritualMadMan

Here's My Problem: I have three Python Modules (using 2.7.2) TC_Config.py merely holds Common Variables used by both of the other two Modules. pyTC.py is supposed to be a Test and Flow Control (Master) Module that once standardized will not be changed (much). ptf.py is a module that will be …

Member Avatar for SpiritualMadMan
0
145
Member Avatar for hughesadam_87

Hey everyone, I'm making a data analysis suite in python, and want to construct a custom event handler which will reset the axis based on the data in the current subplot. To do so, I need the event handler to know what data is currently in the subplot. The matplotlib …

Member Avatar for hughesadam_87
0
177
Member Avatar for LoveMyPadres

HELP MR. WIZARD!! I have been using PySNMP for a while, talking to devices and getting values very successfully. I now need to set a TRAP; this is where you tell the device to notify me when something happens, and then you wait for it to happen. I'm guessing that …

0
77
Member Avatar for uvaryani

Hi, I am new in a python2.7. Please help how efficiently we parse and store the fields in dictionary for later retrieval. my log file example #Version: 1.0 #Fields: date time c-ip s-dns x-proto s-parser cs-resource s-resource sc-response-code sc-response s-candidate-ips x-preferred-location x-location cs-user-agent s-ip c-port #Software: vx-logfeed 1.3 #Start-Date: 2011-04-20 …

Member Avatar for woooee
0
281
Member Avatar for needpython_help

Hi everyone, I'm new here so I hope I've put this in the right place. I'm looking for a little help with a python program I've written. I'm trying to create a timeline from SQLite databases. I take information from a calls database, then an sms database, write those to …

Member Avatar for Enalicho
0
833
Member Avatar for Thropian

I'm hoping I'm not the first to deal with this issue but here goes. running py2exe I get this error [CODE]Traceback (most recent call last): File "setup.py", line 4, in (module) setup(console=['hello.py']) File "C:\Python27\lib\distutils\core.py", line 152, in setup dist.run_commands() File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "C:\Python27\lib\distutils\dist.py", line 972, …

Member Avatar for Thropian
0
799
Member Avatar for SpiritualMadMan

Never did much stuff with "Classes" while still writing in VB6. :) I have the following wxPython Class in my pyTC file [code] class InfoUUT(wx.Frame): def __init__(self, *args, **kwds): # begin wxGlade: InfoUUT.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.label_1 = wx.StaticText(self, -1, "This TPS is for the following UUT") …

Member Avatar for woooee
0
121
Member Avatar for kayoh

Hey guys, I working on an assignment in which I have to write binary/hex to a file. More specifically, I have a variable that holds a memory address that needs to be written to the file big endian but every time I try to write it, python being python treats …

Member Avatar for kayoh
0
201
Member Avatar for TrustyTony

Here is simple math program to list number whose all factors are in given set of factors. I have included my timing decorator, which uses my timestring function, so I included that and imports for decorator in the decorator function, bit against the rules. Of course I could have used …

0
271
Member Avatar for JoshuaBurleson

I'm trying to understand utilizing classes and their methods. I made a simple program to exit or print 'Will continue' given a word. however I keep getting a TypeError for self and through reading my books and searching online I'm still not quite sure why. the code is: [CODE]class OffSwitch(object): …

Member Avatar for Enalicho
0
240
Member Avatar for CaptainHook

I have written some code to count the number of upper case letters in a string and the last line will not work? I am trying to print a statement that concatenates a line of text and an integer variable: [CODE]print ("The number of upper case letters are: " + …

Member Avatar for CaptainHook
0
237
Member Avatar for CaptainHook

I am trying to write code to count the number of upper case letters in a string using Python. I have written the following but instead of the code returning the number of Upper Case letters it returns []? An help would be gratefully recieved. [CODE]import re while True: strPassword …

Member Avatar for CaptainHook
0
298
Member Avatar for Niles64

Hi Please take a look at [CODE=python] class ShortInputException(Exception): #QUESTION: Why do I have to inherit from the "Exception" class? def __init__(self, length, atleast): Exception.__init__(self) #QUESTION: Why do I have to add this? self.length = length self.atleast = atleast try: s = raw_input('Enter something --> ') if len(s) < 3: …

Member Avatar for Niles64
0
119
Member Avatar for clousot

Hello, I know the break or continue statements for the loops... But I have a if stetement that I would like to exit from and I don't know how to do [code] value = -1 if true: print 'hello world' # Some unexpected value is set so I would like …

Member Avatar for woooee
0
4K
Member Avatar for kayoh

[CODE]Dim Processors(4) As ProcessorType For j = 1 To 4 Step 1 Put #filenum, WritePos, Processors(j).byte0 WritePos = WritePos + 1[/CODE] I'm in the process of translating this VBA code to python, and essentially what it does is creates 4 Processor Objects but as you can see from the for …

Member Avatar for kayoh
0
285
Member Avatar for gge18

hey!! this is my first time to post question in this board. i learn a lots from this place. now , i really got a problem for this programming. anybody can help me!!!! i done "Add" part but i don't konw right or wrong and for "pass" i really need …

Member Avatar for CoscNinja
0
423
Member Avatar for fingerpainting

Here's what I'd like to do as an exercise to improve my Python and to play with the idea of genetic programming in basic form. From within a script, I'd like to spawn a number (1000?) of additional scripts with randomly generated but grammatically sane Python related to a very …

Member Avatar for TrustyTony
0
174
Member Avatar for Teamo1234

write a piece of code that ask the user to set a password - queries the user for his/her user name - queries the user for his/her password twice, making sure the user enters the same password twice - Allow Only 3 attempts to get a correct password the rules …

Member Avatar for Enalicho
0
249

The End.