15,408 Topics

Member Avatar for
Member Avatar for Chris9999

[code=python]Y=1 N=0 cont=Y print "Welcome to SCLMIP(Simple Calculator For Linux Made In Python)" while cont == Y: equation=input("Equation: ") print equation cont=input("Continue? (Y,N)") else: print "Exiting..." [/code] If you type 5/2 you get 2, I want it to display 2.5. A workaround is typing 5.0/2.0, but it gets annoying. I …

Member Avatar for Ene Uran
0
84
Member Avatar for lilith2k3

I just registered here on this site. It seems a nice place to be;) Just before writing these lines i poked around here and read some of the tuts and looked into some fora. I'm somewhat of a programming layman, started sometimes long ago but focussed then on other things. …

Member Avatar for MakeMoneyOnline
0
132
Member Avatar for klay.martens

Hi all, Could not work out if this belonged in the c++ forum, or the python forum.... Basically, I am writing an application in c++ which embeds python. The annoying thing is that I have no way of knowing in advance what version of python will be installed on a …

Member Avatar for klay.martens
0
169
Member Avatar for simplecreator

Me and my cousin are making a python text-editor. and im having trouble getting our program to work with py2exe and im not sure what the problem is. I set everything up like the py2exe website tell you to and it all went together perfectly fine. but when i try …

Member Avatar for AceofSpades19
0
274
Member Avatar for pratap.iiit

I have written a small code to parse and execute a sql statement but it fails to execute statement if it caontains ['<=','>='.'!=','<>'] how can i make changes in following regex. rawstr = r"""(.*)[( *)?]?([|=|>|<])[( *)?]?(.*)""" string_to_join="([ *]?and|[ *]?or|[ *]?not)[( *)?](.*)[( *)?]?([=|>|<])[( *)?]?(.*)" sql statement ="select name from table_name where …

0
46
Member Avatar for dinilkarun

Hi All, If anybody has worked on the custom tree control in wx.lib of wx python 2.7 and above, can you please help me in implementing the checkboxes in it as i'm unable to do so.... Regards, Dinil

0
52
Member Avatar for LaurenceB

Hi, this is my first post. Ive made a number game which is written in python 2.5 and have some problems with it: ------------------------------------- import random # You've got to guess 4 numbers between 0 and 30, if you one right the program will output "WINNER" and tell you the …

Member Avatar for LaurenceB
0
90
Member Avatar for Wumbate

I have a question about the range function. How is it that the function has three parameters (start, stop, step), but the mandatory one (stop) is in the MIDDLE? I thought mandatory parameters have to be at the beginning, and optional parameters come afterwards? When I try to create my …

Member Avatar for woooee
0
157
Member Avatar for marcosjp

Hello there, again! Well, once I solved the stupid bug I had in my first Python class ever, now I'm getting results I wasn't expecting. The problem is: I instantiated two objects of this class but, apparently, one of the objects is just a copy of the other. And if …

Member Avatar for marcosjp
0
154
Member Avatar for mharter

Hello, I am trying to write a login script for a windows network that gets the groups that a member is part of from active directory in order to determine what drives to map. I am attempting to use Tim Golden's active_directory module to do this however when I try …

Member Avatar for ldk
0
95
Member Avatar for marcosjp

Hello! I'm studying Python and wrote a very simple class to work with bidimensional arrays - just as an exercise. Before writing te class I played around with functions and they worked fine. When I tried to do the same using a class, things became strange... Okay, I wrote this …

Member Avatar for marcosjp
0
315
Member Avatar for wowimbored

I'm just learning python and i'm trying to make a game where someone puts in 3 numbers and the program picks one of them at random [ICODE]import random print "Enter 3 numbers and i'll choose 1 at random" a = 0 b = 0 c = 0 nmlist = [a, …

Member Avatar for wowimbored
0
81
Member Avatar for puliamrm

Hi! I just started using Python yesterday and I have written a program that reads in a very large data file and rearranges the data so that it can be read into a different program. I am doing this for some engineering modeling simulations. I wanted to create an interface …

Member Avatar for sneekula
0
98
Member Avatar for s7plc

Ok, I would like to use a regular expression that I create dynamically to search and replace words in a file. For instance: import re fl = re.compile('abc|def|ghi') ts = 'xyz abc mno def' n = fl.search(ts) print n How would I find all matches in the string? So far, …

Member Avatar for sneekula
0
6K
Member Avatar for PC_Nerd

Hi. *** SHORT QUSETION: Is there a way I can run a <large> socket server withought having to have a thread for each client/socket created? ***LONGER EXPLAINATION IVe recently written a small network program, that sends messages over TCP or UDP... depending on user input. I want ot adapt that …

0
61
Member Avatar for Agni

Hi, I have 2 modules, grepforapp.py and myApp.py. Basically i'm trying to make a 'search' utility. myApp makes the UI with one textbox for taking input, start button and a list box which displays the file names where the pattern was found. grepforApp walks through the dir tree and searches …

Member Avatar for woooee
0
197
Member Avatar for SUBHABRATAIISC

Dear All, I am trying to write the following code: def try1(n): a1="God Godess Borother Sister Family" a2=a1.split() a3=raw_input("PRINT A WORD") a4=a1.find(a3) print a4 a5=[] if a4>0: a5=a2.index(a3) a6=a5+1 a7=a2[a6] print "The new word is" print a7 a8=a5.append(a7) print a5 elif a4<0: a11=a3 print "The word is not availiable in …

Member Avatar for ssharish2005
0
86
Member Avatar for AdamGr

I am currently trying to convert a program I just wrote to application form, on the Mac. I'm using py2app to accomplish this, and everything works fine up until the last stage; when I try to complete the conversion with: [code] python setup.py py2app [/code] and then run the resulting …

0
49
Member Avatar for ddrddrddrddr

Here's my code: [code=python]from Tkinter import * import tkFileDialog import ImageTk import Image class GUI(Tk): def __init__(self, master = None): ## self.apfr = Frame() ## self.before = self.graphicWindow("Input") ## self.after = self.graphicWindow("Output") ## ## self.apfr.icon = Button(self.apfr, text = "Minimize", ## command = self.ico) ## ## self.apfr.quit = Button(self.apfr, text …

0
58
Member Avatar for megazear7

I made a Class, and I am trying to change a variable (a variable that I set up at the beggining of the program) from inside a Class. But an error pops up and says: "local variable 'widget_stock_price' referenced before assignment" I made the variable "widget_stock_price" at the beggining of …

Member Avatar for vegaseat
0
90
Member Avatar for FreezeBlink

It's always bugged me how it seems that the only way to find out where you are inside a for loop is to use a counter. For instance, suppose you want to iterate through a list, and print every entry on a second line, but for the second-to-last entry you …

Member Avatar for vegaseat
0
93
Member Avatar for lllllIllIlllI

Hi Guys What i am trying to do here is have a tuple of numbers, lets say X. Then i have a list of a few other tuples. I want the program to find the tuple that is closest in value. [code=python] x = (214,521) lis = [(200,500),(250,550),(300,600)] [/code] I …

Member Avatar for vegaseat
0
119
Member Avatar for JDCyrus

Hi everyone. I just found this site today and I decided to join. I'm an amateur programmer, Python mostly, and I'm hoping I'll have a good time and be able to get some support here. See you all around!

Member Avatar for selfhelpebooks
0
55
Member Avatar for smolds

I have a Python program that uses Mechanize to open a page at a website with a log-on/password form, set the entries to preset values and then submit to begin the session. This works, I can get the log-in/password from a form I build in the program. What I an …

0
105
Member Avatar for dinilkarun

Hi all, I want to append our own images with nodes and their children in a tree control. I am using wxPython and it has wx.ART feature which contains many custom images, but if I want some other images to be appended in a tree, what should I do? Please …

Member Avatar for kabila
0
121
Member Avatar for dinilkarun

Hi all, I am using a tree control for multiple selections by implementing "wx.TR_MULTIPLE" property. The tree is bound by the event "EVT_TREE_SEL_CHANGING". On click of each item, value for that item is being populated.Similarly, The value should disappear on clicking the selected item again.Now,when I click the last item …

0
63
Member Avatar for tzushky

Hello, Here I go again. I have the simplest of ideas...yet cannot seem to find a solution to implement it: [CODE=Python] from socket import * import time BUFSIZE = 256 IP = 'localhost' PORT = 25000 ADDR =(IP, PORT) tcpCliSock = socket(AF_INET, SOCK_STREAM) tcpCliSock.connect(ADDR) tcpCliSock.send('I want a response from you …

Member Avatar for tzushky
0
150
Member Avatar for jikanyau

i have been trying to create my python command prompt directory but always recieve this imformation "the system cannot find the path specified" please i will be glad if someone can shade more highlight on how to set the python command prompt directory

Member Avatar for lllllIllIlllI
0
97
Member Avatar for bitmaster20

How do you add directories whose absolute path cannot be guaranteed. For eg, in the directory structure below, I would like to add the "personal", "personal/util", "personal/net" and "personal/lib" directory to sys.path. The "Python" directory could be sitting anywhere in the file system. I added [B]sitecustome.py[/B] to "Lib/site-packages", however, I …

Member Avatar for bitmaster20
-1
158
Member Avatar for mg0959

Is there any way to put multiple lines of text in each selection part for the tkinter listbox? Thanks for the help.

Member Avatar for woooee
0
2K
Member Avatar for devstudio.2007

Dear all, I installed Two applications in same PC, these two applications using import sys options my problem is i cant import Python path for Second application because in Import sys is tracking only first path in python path so how to import Second Path also using import sys regards …

Member Avatar for woooee
0
94
Member Avatar for TheOneElectroni

Hi everyone. I'm using ReportLab to generate pdf report from my price list application. The application runs on windows xp o.s. and is made with tkinter. What the app make now is that when I press the printPdf button a pdf file with a preset name is created in the …

0
87
Member Avatar for anetrev

Was infected with Vundo and Boaxxe.dll, Malwarebytes removed 318 Vundo and Adware trojans, I don't know if Boaxxe.dll is gone but... When my computer starts up .... I recieve a message box that states: Windows can not open this file: File: (name of file.lnk ) To open this file Windows …

0
90
Member Avatar for zachabesh

Hopefully this question is easier than I think it is. :) I have a directory with thousands and thousands of flv and jpeg files in it. I want to loop through the directory, get the file names and their sizes (in bytes) I've tried searching the web for a function …

Member Avatar for zachabesh
0
133
Member Avatar for FreezeBlink

I've been trying to program a "press any key to continue" function, simply because raw_input feels noobish, but so far I haven't been having much luck. I did a search and the opinions are nearly unanimous that getch() is the way to go, but...things haven't gone that well. Here's an …

Member Avatar for FreezeBlink
0
191
Member Avatar for amccorm

Hi, I'm taking a shot at the netflix challenge and relearning C++ at the same time (I usually code in Python now). I'm storing the data in the following structure: typedef struct ndata{ unsigned int userid : 22; unsigned int rating : 3; unsigned int : 0; unsigned int movieid …

Member Avatar for Jishnu
0
93
Member Avatar for gertblue

Hi! I've been working with radio buttons and I've been having some trouble. The basic problem is that even though I can create the radio buttons (and I can select which one I want) that they don't do anything- nothing is printed or tells me what the "user" selected. Here's …

Member Avatar for woooee
0
281
Member Avatar for webamateur

I have a list that is retrieved with python from MS Access. This list needs to be sorted alphabetically before being printed on the web browser. Here is what I have and I need it sorted by the P_LastName. [CODE]dbc = odbc.odbc('Intra//') csr = dbc.cursor() q = "SELECT P_ID, P_FirstName, …

Member Avatar for woooee
0
96
Member Avatar for haikur

Hi everybody! I'm trying to write a program that is able to look inside a txt file and change, for example, the first word with a similar word. The txt file will have one word for line. EXAMPLE::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ORIGINAL TXT FILE: tom lives CHANGED TXT FILE: mum lives :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: I …

Member Avatar for Miyuki
0
128
Member Avatar for Agni

Hi Guys.. Can someone explain to me what's the difference between sending any data over a socket vs sending an http request? i mean sending an http request would also be happening over a TCP socket, am i right? so basically it's as simple as sending data from client socket …

Member Avatar for tzushky
0
714
Member Avatar for Agni

Hi, When i search for a pattern in a file how do i get the line and line#? basically i want to replicate the 'grep' command functionality. Now i can easily say whether the pattern exists or not using re.search funtion but i'm not able to print that particular line …

Member Avatar for Agni
0
125
Member Avatar for wdyck

I am parsing an XML file with encoded entities in it (&amp; and so on). If I use minidom to parse the XML file, minidom will unescape the entities and display the correct value. If I use pulldom, it skips the entity and moves onto the next line. For example, …

0
43
Member Avatar for deostroll

I've create a C program that makes a call to routines which I create inside of python...however when I copied the final exe to another machine the program crashed saying it couldn't find the python25.dll...tried looking for it but could not find it. Is it enough that we have this …

Member Avatar for deostroll
0
84
Member Avatar for jobs

I would like to convert url into md5 hash. My question is that md5 hash will create collision at 2^64. If you do long(value,16), where value is the md5 hash string, would value returned from long(value, 16) be unique as long as md5 hashed string is unique? when you move …

0
75
Member Avatar for dr_kac

Hello everybody! As I thought I became more comfortable with data structure I've got the problem I can't solve. It looks so: I have that kind of text file: ABCD vvvv 1e-12 ABCD hhhh 1e-6 ABCD ggggg 1e-3 ASDE ffffff 1e-57 ASDE dddd 0.001 etc. I would like to read …

Member Avatar for paddy3118
0
192
Member Avatar for olipals

Hi. I'm making a program to plot carrier concentration as a function of semiconductor depth. The program is almost ready, the last part I'm missing is actually making the plot. I've been googling a lot and never found a simple example of how to use the plot. My data is …

0
45
Member Avatar for s_jmp

i have seen in some examples that when they are explaining the sockets they write a sck.bind(('',PORT)) for server and a sck.connect(('',PORT)) for the client part but when i try to use this code it doesnt work but when i change the client part to sck.connect(('localhost',PORT)) it works fine. so …

Member Avatar for tzushky
0
99
Member Avatar for reyev

Hi everybody! I need to split my path, let's say' "C:\path1\path2\path3\path4" into separate strings... Not sure how to do that, I've tried os.path.split / splitdrive etc. but it always give me just 2 arguments I need to get "C:\path1" from this path string for example, which would be the root …

Member Avatar for reyev
0
139
Member Avatar for odinroot

Hi, Is it possible to access a https site using a certificate and keeping the session alive like it happens in the browsers? I'm doing a console app that needs to access a server by https to retrieve information but using the httplib, each time i make a request it …

0
43
Member Avatar for qerteqr

Hello there, I am new to all this too, I dont really know much about computers but want to learn ... especially interested in how to make a website that doesnt look crap!! Apart from that, Python seems a worthwhile thing to learn about ... n other random things Ive …

Member Avatar for zandiago
0
38

The End.