15,194 Topics

Member Avatar for
Member Avatar for novice20

Hi all, Is there any way to do forward referencing or function prototyping in python..? Being an interpreted language, is lack of forward referencing a drawback of python?

Member Avatar for novice20
0
4K
Member Avatar for losbellos

Hej Guys, I am not a phyton programmer, just on [url]www.luxrender.net[/url] (open source project) we have this annoying problem when we need to dl something the phyton mercury doesnt pass the file size to browser... Can somebody take a helpful look at it? I am sure its just something worng …

0
45
Member Avatar for e-papa

I've tried to make a program that will sort the results of a competition, by asking the user the number of competitors, then the name and score of each one. It worked but now i have to make it recognize when two or more people get the same score (that …

Member Avatar for e-papa
0
220
Member Avatar for srw0801

Hello, so I'm fairly new to python and I have become stumped on this one problem. As much as I would like you to solve the problem for me, I do not want you to do so without explanation, I would much rather have a step by step procedure. After …

Member Avatar for srw0801
0
436
Member Avatar for Joeflims

Hey everybody. I was reading some code on the website and I saw this: [CODE]with open(FILE) as number_file: lucky_numbers = [set(line.strip().split('-')) for line in number_file] [/CODE] What does "with ... as ..." mean? What is it used for? How is it used?

Member Avatar for Joeflims
0
136
Member Avatar for Learn_Pyhton

hii..m stuck in an issue...and need a help I have Try.c file having contents ValidateFunction() { ...... ...... print } .... I want to print data between the braces {....}. Also i do not want to read the contents of file line by line because file is of very big …

Member Avatar for TrustyTony
0
153
Member Avatar for Banjoplucker

[url]http://paste.pound-python.org/show/941/[/url] Having trouble getting a loop to write to a series of newly created sequential blank .wp files. Grateful for any help, thank you. Regards & a Happy New Year! Banjoplucker.

Member Avatar for djidjadji
0
110
Member Avatar for blacknred

I have a share -//192.168.0.11/myshare which has many files in it. Which is the best way to delete all the files in this directory using python? I tried: [CODE]import os folder = '\\192.168.0.12\myshare1' for the_file in os.listdir(folder): file_path = os.path.join(folder, the_file) try: if os.path.isfile(file_path): os.unlink(file_path) except Exception, e: print e[/CODE] …

Member Avatar for jice
0
130
Member Avatar for ChaosKnight11

Hi, I am trying to install the Python4Delphi components, but it doesn't compile (from python4delphi.googlecode.com/svn/trunk). It also seems out of date. What is the best current way to use Python inside Delphi? Any advice or help will be greatly appreciated. Thanks!

0
116
Member Avatar for G_S

Hello, This is a really simple question but I just don't see the error here: [CODE]def foo(): x = input('write something: ') if x == 1 or x == 2: print('OK') else: print('NO') print(x)[/CODE] Why does it keep printing NO? Also, I have a more complicated one: def foo(x, y): …

Member Avatar for G_S
0
114
Member Avatar for kiranbkrishna

Hi all, i was writing a gui for a small desktop application i made as a part of learning python.I use python 2.7.I used Tkinter.I am new to python and this was my first trial with Tkinter. First i created 9 buttons arranged in the form of a 3*3 matrix …

Member Avatar for TrustyTony
0
367
Member Avatar for jarograv

So I have a program I am making but I need to make it more efficient, is there any way to condernse the following code into a more compact and efficient code? [CODE]r1p1=o r1p2=o r1p3=o r1p4=o r2p1=o r2p2=o r2p3=o r2p4=o r3p1=o r3p2=o r3p3=o r3p4=o r4p1=o r4p2=o r4p3=o r4p4=o r5p1=o r5p2=o …

Member Avatar for woooee
0
205
Member Avatar for TrustyTony
0
787
Member Avatar for predator78

Hello all!!! It's been a while but glad to have enough time to be back. My question is basically one of design. I'm working on a new project using pygame at the moment, mainly to brush up on and enhance some Object Oriented skills. The project itself is basically going …

Member Avatar for predator78
0
161
Member Avatar for tvks

Hello, I am a newbie in python. I have a unicode in Tamil. When I use the sys.getdefaultencoding() I get the output as "Cp1252" My requirement is that when I use text = testString.decode("utf-8") I get the error "UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-8: character maps to …

Member Avatar for TrustyTony
0
178
Member Avatar for hughesadam_87

Hey fellows, I've created a fairly large math suite for my spectrometer research, which is basically a set of programs that does several math operations, generates plots etc... It's beginning to get pretty bulky, and seems like it would benefit from a nice class; wherein, I could store all the …

Member Avatar for TrustyTony
0
120
Member Avatar for jintujacob

Hey friends lets checkout a small, simple and cute python program for taking photos with with your webcam without the help of any third party application programs. [CODE] import os import datetime import opencv.adaptors from opencv import highgui import Image def get_image(camera): im = highgui.cvQueryFrame(camera) # Add the line below …

Member Avatar for jintujacob
0
411
Member Avatar for e-papa

I wrote a program which I tested in the IDE of python 3.2, it worked but whenever I open the program directly or run from command prompt, it doesn't run correctly, after the user inputs the correct answer, the program keeps saying try again. [URL="http://www.daniweb.com/software-development/python/code/359115"]here's the program it's in the …

Member Avatar for e-papa
0
645
Member Avatar for koveras vehcna

Hello everyone, I have created my own random text generator with a custom method, no Markov chains included, and now I would like to try it on a different text corpus that is larger from that of NLTK's and I wanted to know which Data structure should I use in …

Member Avatar for koveras vehcna
0
240
Member Avatar for SakuraPink

Hi all, I'm trying to read data from this xml file that looks like this: <VEGETABLE > < FRUIT > <FRUIT name="apple">1</FRUIT> <FRUIT name="Orange">2</FRUIT> <FRUIT name="Benana">6</FRUIT> I wrote the following script:[CODE]import sys from xml.dom.minidom import parse from cmath import sqrt # Load XML into tree structure tree = parse(sys.stdin) #Find …

Member Avatar for SakuraPink
0
4K
Member Avatar for gabb810

I am trying to implement this code for hash table in python and i don't understand why i and k are not used in the while loop. Can somebody help me please, [CODE] import random data = [] m = 10 t = [] for i in range(10): data.append(random.randint(0, 100)) …

Member Avatar for vegaseat
0
219
Member Avatar for buster2209

I"m trying to determine if the user is root or not then prompt to become root user; [CODE]if os.geteuid() != 0: # If not root user... os.system("gksudo crack.py") # Open root password window else: # Do Nothing if os.geteuid() == 0: # If you are root user... os.system("You are now …

Member Avatar for buster2209
0
4K
Member Avatar for MUFC4life

Hello, my task is to create a basic game using Pygame. I decided to do the basic snake game like the one that was on all of the old mobile phones. However when inputing some of the basic code, i realised that once i have paused my game i have …

Member Avatar for griswolf
0
188
Member Avatar for Fo.katia

I have to creat a program that draws squares instead of circles. It also has to draw additional squares for each mouse click, and at the end print a message "Click again to quit" after the loop, and wait for a final clikc before closing the window. This is what …

Member Avatar for vegaseat
0
465
Member Avatar for aaronmk2

I am trying to only have the words print out if they occur the same number of times as in the fibonacci sequence. If a words show up 1,2,3,5,8 etc then it will print up. I have gotten the program to print up the words based on how many times …

Member Avatar for vegaseat
0
102
Member Avatar for bilik

Greetings all! Anyway excuse my English. I can't understand how I can do this: <loop cycle; variable is filled by some values> <loop is still running, but simultaneously another command is running> <loop is terminated; i want to read variable> More specifically (it concerned with Scapy module, but I'll explain …

Member Avatar for woooee
0
147
Member Avatar for South

For some reason it just jumps to the else statement instead of going to if and elif. Any input would really be apreciated. [CODE]a=raw_input( "What is your name: ") b= int(raw_input( "What year were you born: ")) c= int(raw_input( "What year is it now: ")) print "Hello",a,"you are",c-b,"years old." class …

Member Avatar for South
0
116
Member Avatar for ThePythonNoob

I have stated to make a program called virtual Tv, I have been having troubles with variabels and I need the variable: state to be able to be change and accessed outside the class and inside, but I think that state is a local variable at the moment. [CODE]import random …

Member Avatar for lrh9
0
210
Member Avatar for imperialguy

I want to limit the size of a list control box. Let us take the following code: [code] import wx class Students(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(380, 230)) hbox = wx.BoxSizer(wx.HORIZONTAL) panel = wx.Panel(self, -1) self.list = wx.ListCtrl(panel, -1, style=wx.LC_REPORT) self.list.InsertColumn(0, 'name') self.list.InsertColumn(1, 'age') hbox.Add(self.list, …

Member Avatar for richieking
0
245
Member Avatar for Joeflims

Hello. I have been trying to run a simple script in Windows 7 DOS using the python command, but it returns this error message: 'python' is not recognized as an internal or external command, operable program, or batch file. I've looked up how to fix on Google, but I can't …

Member Avatar for TrustyTony
0
771

The End.