15,181 Topics

Member Avatar for
Member Avatar for aint

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 …

Member Avatar for TrustyTony
1
409
Member Avatar for netvigator

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 …

Member Avatar for Tech B
0
1K
Member Avatar for captain.don

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 …

Member Avatar for Tech B
0
193
Member Avatar for Ene Uran

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 …

Member Avatar for vegaseat
0
3K
Member Avatar for afireinside

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 …

Member Avatar for vegaseat
0
260
Member Avatar for Aeronobe

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

Member Avatar for vegaseat
1
168
Member Avatar for tcotto

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 …

0
17
Member Avatar for albertkao

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 …

Member Avatar for sergb
0
185
Member Avatar for TitusPE

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 …

Member Avatar for TrustyTony
0
203
Member Avatar for albertkao

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 …

Member Avatar for jice
0
3K
Member Avatar for macca21

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 …

Member Avatar for TrustyTony
0
190
Member Avatar for Mezzck

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, …

Member Avatar for Mezzck
0
427
Member Avatar for thehivetyrant

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 …

Member Avatar for griswolf
0
707
Member Avatar for pixeldroid

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 …

Member Avatar for TrustyTony
0
243
Member Avatar for owls

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 …

0
31
Member Avatar for ShinyDean

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 …

Member Avatar for vegaseat
0
2K
Member Avatar for Seagull One

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 …

Member Avatar for jcao219
0
137
Member Avatar for snippsat

Many of us like wxpython,so is always fun with a new tool.:) [url]http://wxformbuilder.org/[/url]

Member Avatar for joetraff
2
907
Member Avatar for Kruptein

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 …

0
78
Member Avatar for ultimatebuster

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?

Member Avatar for HiHe
0
130
Member Avatar for HiHe
0
9K
Member Avatar for HiHe

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 …

0
76
Member Avatar for Lapixx

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 …

Member Avatar for ultimatebuster
0
166
Member Avatar for TrustyTony

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 …

Member Avatar for TrustyTony
0
2K
Member Avatar for alabandit

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 …

Member Avatar for alabandit
0
122
Member Avatar for nsutton

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 …

Member Avatar for nsutton
0
111
Member Avatar for Aeronobe

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 …

Member Avatar for Aeronobe
0
95
Member Avatar for Qwazil

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 …

Member Avatar for TrustyTony
0
155
Member Avatar for jpl1993

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 …

Member Avatar for TrustyTony
0
137
Member Avatar for Hawkeye Python

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 …

Member Avatar for Hawkeye Python
0
231

The End.