15,190 Topics

Member Avatar for
Member Avatar for s0ur

Hi Experts, I was wondering how to do the following: I have three strings that have five numbers assigned to them for instance, 'a' can equal 1, 2, 3; 'b' can only equal 4 and 'c' can only equal 5. some process happens and I get a result of an …

Member Avatar for s0ur
0
185
Member Avatar for novice20

[B]when the parser is populated with options using optparse, in a case where an option say 'ip' is to be used twice, I get an OptionConflictError. when the conflict handler was set to "resolve" as suggested in [URL="http://docs.python.org/library/optparse.html"]http://docs.python.org/library/optparse.html[/URL] , it resolves the situation by removing '-ip' from the earlier options …

0
50
Member Avatar for novice20

hi... I have written a script for FTP upload using python.. It worked fine when i tried on local boards, but is giving me an error when trying with a remote board via VPN. this is the error i get: [B](104, 'Connection reset by peer')[/B] the machine i developed script …

Member Avatar for novice20
0
1K
Member Avatar for marboleon

I'm trying to display a value on the status bar according to a position on a plot made on a panel. So I want to call the method SetStatusText with the value in a string. The instance of RefreshPanel is set within a frame called 'frame', which is an instance …

Member Avatar for marboleon
0
179
Member Avatar for noniterum03

I am a new python user and I am trying to code an implementation to calculate and empirical cdf. So far, I have some code (attached below) that returns a list of tuples [(datapoint, P(X>=x)),...]. The problem I am trying to resolve is how to take care of replicated data …

Member Avatar for SgtMe
0
105
Member Avatar for patrickgormally

Hi guys! I'm a beginner in Python and I am having a bit of trouble with this program. What I need to do is ask the user how much they must pay, and how much they are paying. Example: Buying groceries that cost $10.27 and the user is paying $11.00. …

Member Avatar for slate
0
160
Member Avatar for ekkanh
Member Avatar for andrewtrench

Hi, I as a Python novice I throw myself at the mercy of experts in this forum. Could someone post a simple example of how to implement urllib2's proxy authentication. I've read all the references google returns as well as searched this site and cannot find an example that I …

Member Avatar for andrewtrench
0
319
Member Avatar for novice20

can anyone show a small sample of how [B]optparse module[/B] can be used to parse a command line arguement? the command line is somewhat like: <scriptname> -ip<ip address> -opt1/opt2

Member Avatar for Gribouillis
0
62
Member Avatar for Krstevski

The class GoogleSuggest will help you to grab the Google suggestion(s) for given expression. [B]Note[/B]: The urllib2 module has been split across several modules in Python 3.0 named urllib.request and urllib.error. The 2to3 tool will automatically adapt imports when converting your sources to 3.0. Example and output: [QUOTE] >>> ================================ …

Member Avatar for TrustyTony
0
653
Member Avatar for parallel91

Hey all, I have a text file and I want to find out the top 40 most used words in the text file. I managed to do that. But, I have another text file that has hundreds of "stop words." When looping through the text file to find out the …

Member Avatar for king_koder
0
275
Member Avatar for HoneyBadger

Guys I am trying to check the size of a item inside a list. How do I search through a list and return items of a certain size? This is what got: [CODE]#This is meant to search through a .txt file an return the words with 20 characters fin = …

Member Avatar for TrustyTony
0
89
Member Avatar for Sykee

[CODE] def main(): #Check to see if quickdraw is located in the correct palce quickfile = file_existance() quickdraw = subprocess.Popen(['java', '-jar', quickfile], stdin = subprocess.PIPE) #Intro, explaining what will occur throughout program intro() # x_coordinate(1) y_coordinate(1) initial_ball(quickdraw) def file_existance(): filename = raw_input("Please enter the name of the file: ") while …

Member Avatar for TrustyTony
0
158
Member Avatar for king_koder

I wrote the following function in Python3 for finding the largest product of numbers along the diagonal(top-left to right-bottom). [CODE=python] def GreatestOnDiagonal(data): '''Returns greatest product possible by multiplying 4 numbers in the diagonal ''' grtProduct=1 for item in data: for n in item: product=1 for r in range(0,4): try: d=data.index(item)+r …

Member Avatar for king_koder
0
397
Member Avatar for zeesix

Hi. I'm very new to python and I'm trying to write something that is conceptually very simple but I'm not sure how to approach it in python. I have 2 files, and basically want to open one file, and replace the content with something in another file. Example: file1.txt only …

Member Avatar for cghtkh
0
116
Member Avatar for HoneyBadger

Guys, I am trying to sort a list. But Python does not let me set my new sorted list into a variable. here: [CODE]list1 = ['a', 'z', 'b', 'y'] sorted_list = list1.sort() return sorted_list[/CODE] When I run this on my interpreter, instead of printing my string sorted, it prints "None" …

Member Avatar for ultimatebuster
0
88
Member Avatar for marboleon

I'm new to Python, so bear with me..... I'm calling the Dislin plotting package from python to plot in a wxPython panel. This works OK but the plot gets grayed out when another window is moved over it. There is a Dislin function, sendbf, which updates the graphics window with …

Member Avatar for TrustyTony
0
178
Member Avatar for fraky

Hi, I am new in python and programming basically. I have a code that compare 2 files by the first column and prints a file with the common lines. But i need it to compare the first 3 columns and print the file. I kind of have and idea of …

Member Avatar for TrustyTony
0
143
Member Avatar for king_koder

Since Django is not yet compatible with Python 3, what are other good web application development frameworks compatible with Python3?

0
81
Member Avatar for testie

Hi all, Ive been working on this little piece of code down there that removes the odd numbers from a list of numbers. I get an "IndexError: list index out of range" whenever I try to run it. From what I understand, it means that l[i] is attempting to use …

Member Avatar for Gribouillis
0
141
Member Avatar for HoneyBadger

Hi, I am trying to split a string and return specific words. I know that using string.split() turns the string into a list of specific words. But how would I go about returning specific words? like the ones that contain certain letters? This is my code so far: [CODE]def e_words(m): …

Member Avatar for TrustyTony
0
187
Member Avatar for RaDeuX

Well that someone would be me. I finished three quarters of C, one quarter of Java, and one quarter of Python at my community college. I think it's about time that I start contributing something to a project, but I have no idea what I want to do. I tried …

0
73
Member Avatar for juand89

Hello, I'm new to python world (I had only programmed on Visual Basic or Delphi), right now I'm doing a program on ironpython studio in wich I need to switch between forms. The thing is that I don't know where and how to initialize "form2" from "form1" to call it. …

0
96
Member Avatar for James0l9l

The first time my code loops through my nested while loop it works. But the second time it doesn't- I don't know why. Could someone tell me the reason. [CODE]m = [['__', '__', '__'],['__', '__', '__'],['__', '__', '__']] z=1 count=9 f=[0,2] from random import choice w=choice(f) from random import choice …

Member Avatar for woooee
0
100
Member Avatar for pacers10

I need to define a function that translates an sentence from present to past. A. put all words in lower case and omit all punctuation B. Plural and singular verbs should be recognized C. verbs ending in "y" change to "ied" D. verbs ending in "e" add "d" E. other …

Member Avatar for woooee
0
132
Member Avatar for Brickmack

Is there a way in python to look through a file line by line and find a word in that line, but only if the word is the first word in the line? Like if it was looking for the word "apple" then it would only notice if the line …

Member Avatar for richieking
0
951
Member Avatar for ekkanh

Hi, how do I write a list to a file on mac os x? I have tried everything..... file = open('test.txt', 'w') mylist = ["rocks","box"] file.write("This doesnt work either") file.write(str(mylist))

Member Avatar for woooee
0
60
Member Avatar for me4ka86

Hello everyone, i faced some problem i cannot solve myself so any help would be appreciated. so here is the task. i have an integer, for example 123. then i want to simulate backspace pressed 3 times and then i want to simulate keyboard presses 1 2 and 3 and …

0
53
Member Avatar for beggers23

I need to write a Python Turtle graphics program to output an n-pointed regular star, where n is an odd integer from 5 -to- 99 input by the user in answer to a question prompt. Also, my program should NOT contain separate code for each different star please help! ASAP!!

Member Avatar for beggers23
0
105
Member Avatar for HoneyBadger

Hi guys, I am trying to iterate through a list. This is my code: [CODE] #assume this is the list: list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] def iter_list(a): for s in a: return s #here it is when it runs: print iter_list(list1) a [/CODE] why doesn't it …

Member Avatar for HoneyBadger
0
109

The End.