15,190 Topics
![]() | |
Hi, I have written a script which parses a UTF-8 text file and prints the required result. The code is below: [CODE] import os import sys import string import csv import codecs usage = "usage: Specify the directories for files and the RDOCK cut-off value" tm_append=[] if len(sys.argv) < 1: … | |
![]() | Hello, I'm a Python/SPSS (DANIWEB) beginner and I'm having a hard time getting classes, functions and methods into the right order. I want to write a script for SPSS where I can read text out of an text object from the SPSS-output file. My code looks like this: [CODE=Python] import … ![]() |
[CODE]class Test: def __init__(self, number): self.number = number def getnumber(self): return self.number x = Test(54) y = 'number' print x.getnumber() try: print(eval('%s.%s'% (x, y))) except Exception, e: print(e)[/CODE] This isn't the code I want to fix, but it has the same error. I am trying to return a class function … | |
I made this program during forum discussion for accessing configuration relative to module directory, not main program's position (which can be accessed by sys.argv[0]'s directoryname). As the thread is closed I post my proves as code snippet. | |
Hi, I have got the following requirement: In a file that has many lines, i need to search for a particular line that has the word DTP. The line may be like this in the file: src 172.23.1.23 dst 192.14.2.34 DTP 0 - 65000 If the line with the word … | |
Hi, I have got the following requirement: In a file that has many lines, i need to search for a particular line that has the word DTP. The line may be like this in the file: src 172.23.1.23 dst 192.14.2.34 DTP 0 - 65000 If the line with the word … | |
I know that certain functions will check the script's or module's current directory for the file if no path is specified. [code=PYTHON]open('test.txt')[/code] If that script is run and test.txt is in the same directory that will open the correct file. However, if I try to import that module it doesn't … | |
I want to create a button with the time updating. | |
Hi, I have got a utility "sock" which is C executable (under linux) on my machine. It acts like a server or client based on the arguments passed at the command line. I want to run it through a python script. I am using the subprocess call function to execute … | |
I wrote a python program that gets input from an input file. It works fine for small input files since after opening the file I did this to get the data [code=python] data=fPtr.readlines() [/code] Since readlines only takes the input data and packs it into a list, it is clear … | |
I would like to be ablt to display 25 circles with alternating colours of red and white? But the code I produced does not work.. plz help. from graphics import * w = 300 h = 300 win = GraphWin("Red Circle", w, h) center = Point(150, 150) radius = 80 … | |
Hi, I've been working a lot with text widgets lately, and I have posted several questions here. Again, thanks for all your help. This time I'd like to post something I found out, so you can help me improve it. My program consists of two textboxes. The texts inserted in … | |
Hi! I'm doing software that controls my computer with a wireless navigator that includes Windows CE. I'm doing this with Python. Okay, so lets begin. One of those control options is audio volume controlling. I have a code, that can change Windows XP WaveOut volume on a scale of 0-255. … | |
Write a Python program that creates upside down sentences, like [B] upside down --> umop apisdn [/B] The sentence above is flipped 180 degrees around the end. Some freedom allowed, like an 'a' upside down and reversed is the closest thing to an 'e'. Conversely a 'w' would be a … | |
Does anybody know how to get data from the ethernet port? Is there a library for it? I don't really know how networking works Basically there is going to be a microcontroller sending data over ethernet, and I want to get the data it sends and write it to a … | |
Hi guys... I wanted to import DB2 in Python 2.6 so i downloaded the pydb2 egg file for python 2.6. I used the easyintaller to install the package also it ran successfully. when using eclipse i tried to import DB2 its not showing the package.. plz help me figure out … | |
I've been trying to find pygame that will work with python 3 on my Ubuntu machine far a while with no luck. I can find a version that will work with Ubuntu but now for python 3, or I can find one that will work with python 3 but not … | |
hello guys, I want your help about my code. the problem is when I want to apply in my phone show me this message error. (NameError:name 'app_lock' is not defined). this is my code : [code]import socket, e32, appuifw def choose_service(services): names = [] channels = [] for name, channel … | |
I'm looking for people to test a program, I've just finished the rewrite of a program and I need people to test for bugs etc... It's a program for developers written in python and wxpython-gui-toolkit It's made with the aim on linux, although windows-testers are welcome as well link: [url]http://launchpad.net/d-cm[/url] … | |
Hi everybody, I am experiencing a very weird situation here: I have a program that uses tkinter and python 3, but its search function isn't working under Windows. [CODE=python] from tkinter import * import tkinter.ttk def sort(): pass def find(): start = 1.0 while 1: find = text_to_be_found.get() pos = … | |
I'm currently working on an application that involves reading pdf files into a variable and passing them to a server via http POST method. On Linux, everything is fine because I can use cat and popen: [CODE=python]pdf = os.popen('cat testpdf.pdf').read() #read pdf data in Linux[/CODE] However, in Windows, the DOS … | |
I'm quite new to Python (and programming past pascal) so I'm looking for a relatively simple-to-understand way to do this. All help is much appreciated. I'm looking for the program to take a variable as if it were just normal code, I'll explain via example. I want the code to … | |
I have a set of objects of questions and answers and I need to return all possible combinations of each question and answer in a set of dictionaries. I am new to Python and have done some Google-ing but I don't think I know enough to even know how to … | |
Hi, I have a Text widget and a button that is supposed to sort the Text's contents alphabetically. This time I won't ask you how to do it, I'll rather ask you to correct me. This is how I solved the problem: [code]unsortedT = text1.get(1.0, END).replace("\n", "\n*").split("*") sortedT = sorted(unsortedT) … | |
I have put some xml data in a file the python code below and have been trying to figure out how to get the data from the file add another "person" and then save to the same file again. [code=python] from lxml import etree from lxml.builder import ElementMaker E = … | |
Interesting right? If you read [URL="http://www.daniweb.com/forums/post1252636.html"]this[/URL] amazing tutorial by lionaneesh, you will understand why I posted this brain-boggling code. | |
Hi, I have a different question today: how do I call the python interpreter AND tell it to open a python program from inside another program UNDER WINDOWS? My program is running fine, and it even has a text mode without any graphical interface. Under Linux, you click on the … | |
Hi, I am trying to write a python test script which will start a Server and Client locally and then transfer their STDOUT to two files. This I need to do from the same test script and the asserts should be the next step. When I am doing the same, … | |
Hi folks, I've got a little problem with my queries in sqlite3. I need to select 'brands' (a, b, c, ...) for a 'date' YYYY-MM-DD from my table. As you can see in my script, I'm able to build a query by passing 'selectedDate' or 'selection', but not both values. … | |
Does anyone here know how to use the UnRAR2 module? [URL="http://code.google.com/p/py-unrar2/downloads/list"]http://code.google.com/p/py-unrar2/downloads/list[/URL] I can't for the life of me I can't figure out how get it to do the same thing that zipfile does in a project I am working on. I want it to look for all files of a … |
The End.