15,181 Topics
| |
Hi, What I want to do is, to take multiple sentences, and create a bar representing the sentence length, and under that bars for words, or string of interest. And this process will be iterated over a text, so I can get many graphs on top of each other representing … | |
I am trying to post to this page and get the result: [url]https://writerep.house.gov/writerep/welcome.shtml[/url] I tried this: [code=python] import urllib import urllib2 sURL = 'https://writerep.house.gov/writerep/welcome.shtml' dInfo = { "state" : 'WAWashington', "zipcode" : '98103', "zipext" : '' } sSendData = urllib.urlencode( dInfo ) resp = urllib2.urlopen( sURL, sSendData ) [/code] I … | |
i hv written 2 programs. "process.py" and "Reg_write_read.py". I have created the exe of both,"Reg_write_read.py" program writes a value in registry through which the process.exe(which is located in C:/) executes on computer restart. But when i Restart my computer. the "process.exe.log" error log generates that says : "Traceback (most recent … | |
This is my first experience with Python's Tkinter GUI. I want to write a program where the result of an interim calculation is displayed on a label. Later in the program I want to use this result in another calculation by simply clicking on the label. This is what I … | |
So maybe this is a pretty basic question, then again I am new to python so please bear with me... I have some code, and I have a tkInter checkbox. I figured out how to get the on/off value of the check box but I dont really understand why I … | |
I'm wondering if i can make this shorter: [ICODE]if not link.startswith("javascript") and not link.startswith("mailto") and not link.endswith("pdf") and not link.endswith("ppt"): #do something[/ICODE] Cause this is getting VERY lengthy, very soon | |
So I have this assignment where we have to create connect 4 using classes and make it so you can play against a player or computer. The problem I'm having is returning to the function if the user enters something other than one or two. I know I have to … | |
How do I recursively remove all the directories and files which begin with '.'? My test program rmdir.py does not do the job yet. Please help. Code: #!c:/Python31/python.exe -u import os from shutil import * root = "C:\\test\\com.comp.hw.prod.proj.war\\bin" for curdir, dirs, files in os.walk(root): print (curdir) print (dirs) for d … | |
Hi folks, I wonder if anyone out there could help me with something. I have a folder containing many cnv files that look like this: * Sea-Bird SBE 9 Data File: * FileName = C:\CTD Data\Alg173\stn001.dat * Software Version Seasave Win32 V 5.38 * Temperature SN = 4977 * Conductivity … | |
I want to walk a directory and ignore all the files or directories which names begin in '.' (e.g. '.svn'). Then I will process all the files. My test program walknodot.py does not do the job yet. Please help. [CODE]#!c:/Python31/python.exe -u import os path = "C:\\test\\com.comp.hw.prod.proj.war\\bin" for dirpath, dirs, files … | |
How can I tabulate the data strings I have saved in another file... the data sored is in the form of names and scores. The table should look like: Name Score 1 Score 2 Score 3 ==== ======= ======= ======= John 23 21 34 etc... I've started with this and … | |
I'm new to Daniweb and with Python and I'm quite bad with it to be honest D:.. Here is my code... [CODE]from Tkinter import * class App(Frame): def createWidgets(self): self.grid() self.lbspace = Label(self, text="") self.lbspace.grid(row=0,column=0) self.lbfirstName = Label(self, text="First Name:", font=("Calibri", 12)) self.lbfirstName.grid(row=1,column=0) self.firstNameVariable = StringVar() self.firstName = Entry(self, textvariable=self.firstNameVariable, … | |
Hi there, I'm currently in the process of creating a Multi-User Dungeon (MUD) in python. It'll allow multiple users to explore a text based world. I've got a basic server but i can't seem to get a client to work with it. [B]MUD server.py[/B] [code] import socket #Connect with telnet … | |
I'm learning Python to use wMaya - a 3D graphics app. While reverse engineering some code, I [URL="http://www.daniweb.com/forums/thread89440.html"]found a thread here[/URL] which explains "list comprehension". The code I'm analyzing uses that, so I attempted to deconstruct it, but I can't reproduce the same results using a for loop. I have … | |
Hello I am trying to get this program to log key presses while running hidden in the background. I have no troubles while I run this program as a .py or .pyw The trouble comes though when I have turn this file in to an .exe using py2exe It will … | |
I am currently using the Pil library for a project, however i keep running into the same problem which will not let me do anything at all. [CODE][/CODE] def bw_negative(filename): # Create the handle and then create a list of pixels. image = Image.open(filename) pixels = list(image.getdata()) print pixels[0] print … | |
I'm working with some code to have a robot do vision processing, speech recognition and text-to-speech. I'm using python2.6 and openCV The objective of the code is to have the robot recognize faces via webcam and say, "Hello." It does this more or less perfectly, except for one thing. A … | |
Many of us like wxpython,so is always fun with a new tool.:) [url]http://wxformbuilder.org/[/url] | |
Hey, I've made a program called d-cm, it's a web-development tool. I want to know if everything works and/or if it works on windows too. Therefore I'm asking if some people are willing to test it... [url="http://code.google.com/p/d-cm/downloads"]googlecode project link[/url] P.S. I'm posting it here because in the Show off your … | |
Is this needed? [CODE] class Test: def __init__(self, f): self.f = open(f) def __del__(self): try: self.f.close() except: pass [/CODE] Also, how can i open a file, and have it in append mode. However, if the file doesn't exist, python creates it? | |
Yes, you can merge two class instances in this simple manner. | |
The small code shown below works fine with Python26, however Python31 gives an error: fout.write('.snd' + pack('>5L', 24, 8*dur, 2, 8000, 1)) TypeError: Can't convert 'bytes' object to str implicitly Does anyone know what I need to do to make it work with Python31? [code]# create a soundfile in AU … | |
Hi, I'm trying to create a textgame in python, and after searching for a few topics about it I though I knew how to make it. Many textgames use a system like this: [CODE]def room_one(): #do stuff if something: room_two() def room_two(): #do stuff [/CODE] Most of the time the … | |
Here is my newest baby, the pretty.py module, born today, which I start to use instead of pprint module. Reason to make this (in addition to that it is possible to do) is that I had this problem, sorry long, LONG example: UPDATE: take out the [CODE]or j[/CODE] that was … | |
I generate an array from the folders in a directory; which is placed in an array. i then compare it for changes in the currant folder.This way i can monitor for new files that are add to the system and trigger the script. but i am having problems comparing the … | |
I know the code for sending mail is. [CODE] import smtplib fromaddr = 'fromuser@gmail.com' toaddrs = 'touser@gmail.com' msg = 'There was a terrible error that occured and I wanted you to know!' # The actual mail send server = smtplib.SMTP('smtp.gmail.com:587') server.starttls() server.login(username,password) server.sendmail(fromaddr, toaddrs, msg) server.quit() [/CODE] Basically its a … | |
I'm having this problem with passing a variable. Basically i'm trying to find every url in a HTML document. I'm doing this using the HTMLParser class (i made an extension of it). This is the code: [ICODE]class Parser(HTMLParser.HTMLParser): def __init__(self, url): HTMLParser.HTMLParser.__init__(self) req = urllib2.urlopen(url) self.feed(req.read()) def handle_starttag(self, tag,attrs): if … | |
Hey all, I'm a beginner. When i feed a list of lines into this for statement, i have trouble getting the output into a set for use outside of the for statement. [CODE] ListofWordsinLines = {} words = [] for line in ListOfLines: words = line.split() ListofWordsinLines = set(words)[/CODE] if … | |
class tennis: def __init__ (self, name, rank, tournamentsPlayed, country, racquetBrand): self.name = name self.rank = rank self.tournamentsPlayed = tournamentsPlayed self.country = country self.racquetBrand = racquetBrand #defines each thing^ def __str__(self):#creates a string return self.name + ":" + self.rank + "\n" + self.tournamentsPlayed + "\n" + self.country + "\n" + self.racquetBrand … | |
I'm trying to create a python cards game (a Brazilian cards game). But when I try to print some values (the cards played) it returns the following error: [QUOTE]Traceback (most recent call last): File "<pyshell#16>", line 1, in <module> play() File "C:\Documents and Settings\Terminal\Desktop\Truco.py", line 71, in play print "You … |
The End.