15,175 Topics

Member Avatar for
Member Avatar for teddypwns

How do I get a recursive function to return a value other than None? For example: [CODE]def function(depth): if depth > 0: function(depth - 1) else: return 10 function(5)[/CODE] returns None, and not 10.

Member Avatar for ultimatebuster
0
11K
Member Avatar for jenzilla

Hi. So, I'm coding this GUI into a sort of quiz. I'm not sure how to explain what I plan to do so I will write it out in a pseudo code. I know this isn't the most efficient way at all to do this, but I'm just focused on …

Member Avatar for ultimatebuster
0
2K
Member Avatar for PythonNewbie2

Hey guys, I really appreciate your help so far! :) This one is a tough beast... I don't even know how to approach it. Let me give you a summary version and a detailed version. Summary version: There are all sorts of these XML files scattered within a bunch of …

Member Avatar for Beat_Slayer
0
184
Member Avatar for TrustyTony

I found one interesting site while I was fooling around ... I mean Googling around: [url]http://python-history.blogspot.com/[/url] Maybe you would like to check it out. One of the guys blogging is quite famous in these circles: Guido van Rossum.

Member Avatar for TrustyTony
0
151
Member Avatar for baki100

Hi i'm stuck on this script that i'm busy writing and have no idea where to start. I need a script that connects to a secure ftp, downloads files and store it on my local pc. has anyone done something similar and which modules should i be looking at.

Member Avatar for baki100
0
105
Member Avatar for newyawk

Hi, I have a file that has about 65000 lines and three columns. I need to read in the first 2 columns until line 112960. I then need to write the 12960 lines of 2 columns to a file. This needs to be repeated for about 600 files... I then …

Member Avatar for woooee
0
177
Member Avatar for kuchi

hi I can change dictionary values but I can't figure out to change the keys.. here is the scenario I want.. A dictionary is coming like this {'fstn':'Tim','lstn':'Parker','mdl':'W','dob':'19801201'} now I need to change to {'FIRST_NAME':'Tim','LAST_NAME':'Parker','MIDDLE_NAME':'W', 'BIRTH_DATE':'19801201'} please help me to change the keys..

Member Avatar for kuchi
0
357
Member Avatar for kuchi

Hi I'm very new to Python Language, I'm getting this error "AttributeError: 'str' object has no attribute 'internalSplit'" and don't understand why. please check the following code.. [CODE] sourceAction = str(sourceAction); identityInfoDict = dict(identityInfo); for key in identityInfoDict.keys(): if(key.find("GENESYS_DATA") >= 0): intDict = self.internalSplit(key,identityInfoDict)[/CODE] and the internalSplit is a function …

Member Avatar for kuchi
0
4K
Member Avatar for jtaylor-bye

Evening all. I have decided to try my hand at programming in python. I have tried some of the tutorials on the web but none of them really hold my interest for long. I am looking for a tutorial that covers all the basics and goes quite indepth. All the …

Member Avatar for lrh9
0
137
Member Avatar for rhodi

I'm new to Python and I'm having a problem I can't explain. While running: [CODE] >>> open('word.txt') [/CODE] it returns: No such file or directory: 'words.txt', even if I have both files saved in the same place. I've tried entering the entire file location, but still no luck. Any help …

Member Avatar for vegaseat
0
81
Member Avatar for krishna_sun82

When I try to run a C program that calls a Python function, I am getting this error: [QUOTE]ImportError: /usr/local/depot/python-2.5.1/lib/python2.5/lib-dynload/math.so: undefined symbol: PyExc_OverflowError[/QUOTE] Please help me resolve this.

Member Avatar for Gribouillis
0
46
Member Avatar for gonzigg

Hello, I just finished my "Who wants to be a millionaire Game", (very basic coding), but I got some issues when I click somewhere out of the Boxes range(try it), and I'd like to add some sort of points to each question, and as they go further make the question …

Member Avatar for tbone2sk
0
308
Member Avatar for Musing888

When I run my code the program adds the following before the start of my program: >>> Warning (from warnings module): File "C:/Users/Steven/Documents/CA/CA python/CAMain.py", line 142 def maxgen(fname, worksheet=1,encoding='cp1251'): SyntaxWarning: import * only allowed at module level >>> [I]The first prompt of my program would be here[/I] The code it …

Member Avatar for Musing888
0
1K
Member Avatar for anurag.kyal

Is is possible to check if the execution of a java program from python gives any error during runtime and compile time ? Any help or sample code will be of real help.. Thanks in advance

Member Avatar for Gribouillis
0
83
Member Avatar for pradeeppatil110

Hii I am have suffering few problems in doing following assignment , please help me... Qtprogram using python to calculate addition, subtraction. please help me ...i am new python

Member Avatar for -ordi-
0
148
Member Avatar for Archenemie

While doing a project i decided to do a mechanism in a panal of its own class, so i could manage the sizers and layout better, then i wanted to take the end result of that panel and display it in my window. Although when i run this code as …

Member Avatar for vegaseat
0
113
Member Avatar for j3nny

How do I convert the integer -2 to its hex 0xfe??? I tried hex() but it gives me -0x2

Member Avatar for jcao219
0
91
Member Avatar for rahul8590

I have various list being generated by a mapper function in this format >>> mapper("b.txt" , i["b.txt"]) [('thats', 1), ('one', 1), ('small', 1), ('step', 1), ('for', 1), ('a', 1), ('man', 1), ('one', 1), ('giant', 1), ('leap', 1), ('for', 1), ('mankind', 1)] >>> mapper("c.txt" , i["b.txt"]) [('thats', 1), ('one', 1), ('small', …

Member Avatar for ultimatebuster
0
258
Member Avatar for sks57

Hi Friends, I want to parse a header file and auto generate a .cpp file. Can any one please suggest me good link in doing so or provide me a sample python script which will automatically generate a .cpp file. I planning to using VC++ pre-build event to call this …

0
17
Member Avatar for lewashby

I'M learning python and I can write very small simple programs with Tkinter or play sound through pygame. I've just started the book "Beginning Game Development with Python and Pygame". I'M in the earlier part of the book and I've just been given the program below. The thing is, even …

Member Avatar for TrustyTony
0
220
Member Avatar for prodigenius

numpy.vectorize takes a function f:a->b and turns it into g:a[]->b[]. This works fine when a and b are scalars, but I can't think of a reason why it wouldn't work with b as an ndarray or list. For example: [CODE=python] import numpy as np def f(x): return np.array([1,1,1,1,1], dtype=np.float32) * …

Member Avatar for TrustyTony
0
396
Member Avatar for personx1212

hello, i created an executable from a python project, with py2exe & cx_Freeze for testing, and both versions work fine on my Windows OS, but none work on other PCs (Win32), when i start the executable it says : 'The application has failed to start because the application configuration is …

Member Avatar for snippsat
0
152
Member Avatar for gonzigg

Hello, im starting a new project, about the game who wants to be a millionaire, so In the beggining I have a Start Button, but I want to know how to set the parameters of the mouse click to be only within the range of the START button. heres what …

Member Avatar for Gribouillis
0
232
Member Avatar for jenzilla

Hello, I'm sure there is a simple solution to this but I cannot seem to find the information I need in my textbook or online. I'm creating a GUI with an entry box for the user to input their name. I then use getText() to retrieve the name they entered …

Member Avatar for rahul8590
0
98
Member Avatar for personx1212

Hello there, i have this problem when i try to combine a variable file name that is in languages other than English with a path, like this : path = 'C:\\Files\' path+=UnicodeName+'.txt' it gives the following error : UnicodeDecodeError: 'ascii' codec can't decode byte 0xda in position 7: ordinal not …

Member Avatar for personx1212
0
116
Member Avatar for Malinka

Hello everybody! I have to go through each subfolder and extract matching strings from each of the files (File_1, File_2, File_3, File_4, etc.). Unfortunately, I don't know how to do that under Linux. I have the following structure: MainFolder: ---Subfolder A ------File_1 ------File_2 ------File_3 ---Subfolder B ------File_4 ------File_5 ------File_6 ---Etc. …

Member Avatar for Gribouillis
0
9K
Member Avatar for nuaris

[ICODE]class classA: #saved as classA.py def __init__(self): print "class A" printB() def printB(): print "B"[/ICODE] [ICODE]>>> classA() class A Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> classA() File "C:\Documents and Settings\Owner\Desktop\timetable\classA.py", line 5, in __init__ printB() NameError: global name 'printB' is not defined[/ICODE] Using the class …

Member Avatar for yinchao
0
2K
Member Avatar for yari

Hi, I've been trying to make a poker game, i got the basic things running like giving the cards to the player and dealer, but i am having trouble coming up with a way to compare the 2 hands... I'm new to python, i tried different ways and didn't really …

Member Avatar for yari
0
2K
Member Avatar for Kraln00b

Hello, I could use a spot of help today. I am very new to python (n00b) and I have a rather specific Issue I am trying to resolve. This problem can be solved using ArcGIS (for those who know it) I simply desire to know more about python so I …

Member Avatar for Kraln00b
0
159
Member Avatar for hisan
Member Avatar for Gribouillis
0
7K

The End.