15,190 Topics

Member Avatar for
Member Avatar for Hawkeye Python

Is this possible with pyhton? If it is, how can you do it? [CODE]def raise(): raise = raw_input('Do you really want to raise? y/n') if raise == 'y': bet = bet+1 return # Should RETURN to play(), after raise() # Like "goto LABEL" else: return def play(): bet = 1 …

Member Avatar for lllllIllIlllI
0
93
Member Avatar for jv_05

First of all, excuse me for bad English, I speak Spanish... Well, my question is how do I implement sockets in my program? I'm working on a little game call "Battleship", I already have how to set your ships and the function to attack, but I need to connect 2 …

Member Avatar for lllllIllIlllI
0
176
Member Avatar for xxxchopsakexxx

Ok so if I wanted to do a simple while loop with a user inputting a number and a function doing some calculations, would it be possible to have it so that the user can type in 'quit' instead of a float if they want to quit? Thanks in advance.

Member Avatar for HiHe
0
336
Member Avatar for TrustyTony

Here is way to put easily editable layout for input fields with standard look and collect the text variables to list for use.

0
2K
Member Avatar for nsutton

So I got bored and made a blackjack game. This is probably be the last thing I code in python before I move to C#!!!(so excited to learn it) The game() function is the main fuction all the rest are pretty self explanatory if you understand blackjack. My issue is …

Member Avatar for nsutton
1
225
Member Avatar for vandalised

My task was to create a leapyear program. The following was created: [code] def LeapYear(year): if year % 400 == 0: return True elif year % 100 == 0: return False elif year % 4 == 0: return True else: return False print (LeapYear(400)) print (LeapYear(1000)) print (LeapYear(1012)) print (LeapYear(2000)) …

Member Avatar for griswolf
1
2K
Member Avatar for Aeronobe

I want to test if a value is a key from a dictionary, i do this like so: [ICODE] if value in dict: print "value found" else: print "value not found" [/ICODE] Now this doesn't work if value = "abcd" and the key in the dictionary is "Abcd"... How do …

Member Avatar for Aeronobe
0
109
Member Avatar for vandalised

Hi everyone. Basically i'm very new to python and i'm trying to learn it at a fairly fast pace. One of the books i am using is comparing for and while loops, showing how while loops are more flexible than for loops but more complicated. Anyway to the point.. In …

Member Avatar for HiHe
0
106
Member Avatar for vegaseat

The Python module 'tarfile' is more flexible then it's counterpart 'zipfile'. It allows you to simply archive files without compression, or use the gzip format of compression, or the super compression format bzip2. Here is code to show you the use of the module.

Member Avatar for vegaseat
3
1K
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
263
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
191
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
433
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
713
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
245
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
915
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

The End.