15,179 Topics
| |
Hi, We need to zip files having '2009' in their names from a particular directory. How can we do the same. Code: file = zipfile.ZipFile("test.zip", "w") os.chdir(rawFileLocation) dirList = os.listdir(rawFileLocation) for fnames in dirList: file.write(fnames) file.close() It is zipping all the files. Please tell me the logic for adding files … | |
Can I be able to read a text file from any text editor (eg Ms word, wordpad) using python. and then return whats inside? | |
The following program has two mistakes in it that cause it to print an incorrect answer. [code=python] # Computes how much interest is earned on a given amount of principal. principal = float(raw_input('Enter principal: ')) interestRate = float(raw_input('Enter interest rate as a percent: ')) years = int(raw_input('Enter number of years: … | |
When dealing with big numbers (over 100,000 digits). I find str(myint) too slow. The code below takes my machine 8 seconds. Doing a quick test in java takes 0.186 seconds [code=python] import time #**setup part** i = 0 myint = 1 while i < 100000: i = i + 1 … | |
I recently got into Python and I'm having trouble finding a good IDE for it. I'm on Windows. IDLE works but I'd rather use a different editor with more features. I tried Wing IDE and I can't even find a Run command. Using the command line and typing in the … | |
Hi all I am attaching a Text area to my gui program. For some reason, whenever i try to write/put a string that has a length greater than the width of the text area, It changes line automatically, (seems like it's not adding new line chracter to existing string, but … | |
ok so my code is as follows: [ICODE]read=open('mon_17.py','r') reader=read.readlines() a=[] for line in reader: reader1=[] for i, entry in enumerate(line.split()): if i in range(0,4)+[6]: reader1.append(int(entry)) else: reader1.append(float(entry)) #float the 2 purity values only at this point #reader1=map(float,line.split())#this was made everthing diff made all floats a.append(reader1) a.sort(lambda x,y:cmp(x,y)) read.close() match={} for … | |
Hello, I would like to display the current URL from my address bar. How must I do this? Many thanks, Peter Kroon The Netherlands | |
| Dear Pythoneers, I have been reading really good answers on this forum so I thought I'll give it a try and see whether someone can help me. What I want to do: "I want to embed Python in C++ and use Python's capabilities in order to create a expression evaluator" … |
In python 3, I have to use the __ge__ __le__ and so on members in the class. MY question is, how do I combine 2 objects of the same class type using __eq__ or must it be done from outside? | |
Hi. I need some help here with a unicode string I want to use with strptime. [code=python] >>> date u'\xa08/15/2009' >>> datetime.strptime(date, "%m/%d/%Y") Traceback (most recent call last): File "<pyshell#75>", line 1, in <module> datetime.strptime(date, "%m/%d/%Y") UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 0: ordinal not in range(128) … | |
Hi there, I'd like to know if is there a way to check my e-mail and send e-mails with python. I am trying to do that in Window Vista, and I've tried some codes with smtp, but I couldn't find a solution. Can anyone help me out with this, thanks … | |
I thought I'd set myself a challenge as I've been programming in Python a little while now (nothing too heavy, mind you!) and make a 4-in-a-row game which I could play against the computer or another person, on a grid which i specify how big. I though I had the … | |
Hello. I'm new here, and new to Python. I have a little experience with C++, and assembly, and just started learning Python about 2 weeks ago. I'm trying to write a program that will control servo motors in sync with an audio file (probably .wav). So far I've written programs … | |
Ok, I am writing a client for the "instant messaging" server I just wrote. The client is in all Python, and the GUI is made with Tkinter. Anyways, my first question is this: is there a way to make a scrollbar widget automatically scroll to the bottom? Second, in a … | |
Hi, so in order to make my problem more clear, I shall just make a simple example of what I am trying to do. I will start with a little code: [code=python]from Tkinter import * master = Tk() msgbox = Text(master) msgbox.pack() mytext = raw_input("> ") msgbox.insert(END, mytext) master.mainloop()[/code] Now, … | |
Hello, I have created a telnet server in python. Maybe you wonder why to create a telnet server while Windows has one? Because the windows telnet server does not allow to interract with the desktop. If you try to start a GUI app, it will start and run but will … | |
Hello all, I'm trying to run a simple client/server socket progaram from a refrence of the net to get my feet wet a bit with network programming. I can connect fine but can't seem to send data from the client due to the fact python is saying its of type"str" … | |
Hi, I want to track changes done to wxListCtrl as user Updates it (via my custom dialog of course). I will be querying and saving updates from and to database. the problem I have in thinking how to track changes and enable/disable save button as well as update the database … | |
I am creating a validator for the text entered in the items of a tree. I am using the EVT_TREE_BEGIN_LABEL_EDIT and EVT_TREE_END_LABEL_EDIT to accomplish this. In the scenario that the user enters text that is not allowed, I want a message dialog to pop up to tell them what they … | |
Hi, I cannot see a separator, though it adds spaces between tools. What am I doing wrong? Here is a code below [CODE=python] self.toolbar.AddLabelTool(wx.ID_REDO, "redo", wx.Bitmap("./icons/edit-redo.png")) self.toolbar.AddSeparator() [/CODE] Also what is difference between AddLabelTool() and AddSimpleTool() ? | |
Can Anyone tell me how to use debugger. I have only once used Wingware Wing IDE. I just clicked debugger and it will highlight error! I want to be advanced with debuggers and debugging in python. can anyone tell me how thing go up? Thanks in Advance, S. | |
Hello Guys can somebody provide examples and explanations on how to embed MySQL server using SQLmylibd.dll (If I remember well). Appreciation to all answers, Steve | |
Hi All, Sorry for my posting if it was already in the forum. I could not find the answer to my question. I am newbie. I have never programmed anything. I just started to learn. Now I want to do is to produce automated searches. How can I do that? … | |
I need some help on how to draw graph at runtime in Python. I have logs running continuously which gives me CPU consumption value vs timestamp in a LOG file. (I'm able to parse these two values and create a dictionary entry for each timestamp vs CPU value.) Now I … | |
Hi everyone, I am doing a program with python on Windows Vista, and I've put a entry in my program, now what I need to do is only allow the user to write number, if the user tries to write anything apart from numbers and commas, appears a message box … | |
| As the title suggests how? I have successfully used pyExcelerator to convert an xls file to csv, 1) I downloaded the pyExcelerator file. 2) Extracted it and put the file under C:\Python25\Lib\site-packages 3) Then I ran the example script xls2csv.py example.xls > comma.csv but I would like to know how … |
Hey All I'm having trouble making executables with py2exe. I'm using Python 2.6 and I'm trying to make the simple 'Hello World!' program work as an executable. My setup script is as follows: [code=python]from distutils.core import setup import py2exe setup(console=['hello.py'])[/code] When I run the setup script in the command prompt … | |
Hi all, I was hoping to get some help with a problem I have. I have a function that is outputting this result: test = [[11,22,33,44,55,66]] which I have reason to believe is a nested array? eg. [[11,22],0] or something like this. My question, is it possible to manipulate 'test' … | |
Hello guys, Please help me with wxTreeCtrl events (I have never dealt with TreeCtrl before). I want to get simple basics how to catch events As example to clarify my question, I have tree of books and I want just the TextCtrl to display the chosen parent and Item, like … |
The End.