15,175 Topics

Member Avatar for
Member Avatar for csguy11

[code] def index_dir(self, base_path): num_files_indexed = 0 allfiles = os.listdir(base_path) #print allfiles num_files_indexed = len(allfiles) #print num_files_indexed docnumber = 0 self._inverted_index = {} #dictionary for file in allfiles: self.documents = [base_path+file] #list of all text files f = open(base_path+file, 'r') lines = f.read() # Tokenize the file into words tokens …

Member Avatar for TrustyTony
0
472
Member Avatar for Reverend Jim

Can someone please fill in the missing line of code in OnPageChange? I have a notebook control and on a page change event, I want to retrieve the label of the tab that was just selected. GetLabel and GetLabelText both return '' [CODE] import wx import wx.lib.mixins.inspection class Frame(wx.Frame): def …

Member Avatar for Reverend Jim
0
1K
Member Avatar for KrazyKitsune

Unicode: I would like to use the radical symbol (U + 221A) in my script. How do you print the Unicode without an error? Super/Subscript: Is it possible to make a variable superscripted (and subscripted, for that matter)?

Member Avatar for woooee
0
91
Member Avatar for JDuch

Somebody was so kind as to indicate to me an interactive Python learning program. I started using it, but lost the URL. I cannot find it back in the threads i started. Can this Python forum member remember me of his suggestion? Thanks

Member Avatar for JDuch
0
143
Member Avatar for KrazyKitsune

[code=syntax]from __future__ import division from math import sin from math import cos from math import tan from math import radians a = raw_input("enter 1 for sin, 2 for cos, 3 for tan") if a == 1: degree1 = int(raw_input("Type in angle value: ") radian = radians(degree3) sin = sin(radian) print …

Member Avatar for Stefano Mtangoo
0
574
Member Avatar for jyothics23

Hi, I try to communicate with equipment through serial port. It is slightly order equipment so it requires to send command in a specified format ends CHECKSUM (Like start with 'STX' and end with 'ETX' etc and the command looks something like '020T025F00R000000000000000'). [B]Issue with Python:[/B] For my case they …

Member Avatar for Tech B
0
2K
Member Avatar for gunneronaspooky

Okay...I'm back again for the next program...here's what i have so far [CODE]print "Euclid's Method" a= raw_input(("Enter first number ")) b= raw_input(("Enter second number ")) def euclid(a,b): while b != 0: a, b = b, a%b return a[/CODE] My question is, how do I get it to print out the …

Member Avatar for gunneronaspooky
0
140
Member Avatar for Delu:sional

I just installed eclipse and Pydev. but I can't I can't add Python 2.7 as the interpreter for Pydev. I couldn't find the interpreter file at 'mac/usr/local/bin/' I only see /python 3.1 and some others. Is it because of I have installed 3.1 and 2.7 both? Even then I click …

0
94
Member Avatar for udev

Hi! In every iteration of reading a file I populated a dictionary and appended it to a list . A part of that list looks like this : . . . Key Doc ID freq line number {'Emin': ({'file13.txt': 1}, {'Emin': [38]})} {'Gun': ({'file13.txt': 2}, {'Gun': [43, 71]})} {'I': ({'file13.txt': …

Member Avatar for udev
0
126
Member Avatar for matkod

Hi, Im trying to create a canvas as a background but i can manage to work =/ I create a window with the text and the size of de image, but the image is not there can someone help me? thanks. [CODE]import Tkinter as tk import tkMessageBox class Janela: def …

Member Avatar for woooee
0
7K
Member Avatar for xtra333

Hi Guys. I am new here. I am trying to run a Poker program that can detect the different hands in poker. here is my code [CODE] class Card: # A card is an Object with a suit and rank # attributes. def __init__(self, rank, suit): # To create a …

Member Avatar for xtra333
0
2K
Member Avatar for kinniburghc

I want to create a jpg image containg some graphics which I draw using the Tkinter Canvas widget. This draws the image to screen and then I use the PIL library ImageGrab() function to grab it off the screen into a file. It would be much neater to by-pass drawing …

Member Avatar for kinniburghc
0
7K
Member Avatar for gudumba

Hi, I started Python command prompt and entered this: import distutils.dir_util as du du.mkpath( "c:/foo/bar" ) #assume dir 'foo' doesn't exist This works fine and it creates the path 'foo/bar'. Now, go to file explorer and delete the dir 'foo' and go to the Python prompt and issue the same …

Member Avatar for Stefano Mtangoo
0
185
Member Avatar for pixelss

Hello, i'm very new to programming in genera. Python is the first language I'm learning. So, I was instructed to make a program that ask the user for loan payment, insurance, gas, oil, tires, and maintenance. The program will calculate the monthly cost and annual cost. here is what i …

Member Avatar for pixelss
0
474
Member Avatar for Tenck

I know it's one of those programming languages thought of as an easy thing to learn (or so it seems like it). My problem is not with the difficulty of learning the language, rather the outdated guides and the problems with Python 3.2. So I looked into a book called …

Member Avatar for snippsat
0
283
Member Avatar for sikais17

hey guys.i have one realy big big problem.. My programming teacher gave my a task to get these functions to work, but i dont know python program so good.. thats why maybe someone of you could help me, and make these 3 functions to work .:).. please!! these lines are …

Member Avatar for sikais17
0
152
Member Avatar for Rocanlover1

I need help with this. At the end of the semester, students often wish to know what grade they need on the final exam to get an A in the course. Write a program that prompts for the user’s grades on exam 1, exam 2, and the homework and from …

Member Avatar for TrustyTony
0
144
Member Avatar for a007s

I have this program I'm trying to write, a simple application with gui: a menu and a button. Whenever I go to run it, this is the error I get: Traceback (most recent call last): File "/Users/[I]myname[/I]/Documents/School/Programming/Window.py", line 27, in <module> app = Application() File "/Users/[I]myname[/I]/Documents/School/Programming/Window.py", line 14, in __init__ …

Member Avatar for a007s
0
3K
Member Avatar for UaBoy

I am new to this whole programming thing. I am currently using python 3.2. I want to get into trying to build GUI, but i can't find any programs that seem to work with python version 3.x. Should I downgrade to an earlier version of python? If so what is …

Member Avatar for vegaseat
0
247
Member Avatar for guyfrompluto

I need to write a function that takes in an array of integers and an integer, checks if the sum of any of the numbers in the array is equal to the supplied integer. Any ideas would be much appreciated.

Member Avatar for Beat_Slayer
0
700
Member Avatar for lewashby

[CODE]background_image_filename = 'sushiplate.jpg' sprice_image_filename = 'fugu.png' import pygame from pygame.locals import * from sys import exit pygame.init() screen = pygame.display.set_mode((640, 480), 0, 32) background = pygame.image.load(background_image_filename).convert() sprite = pygame.image.load(sprice_image_filename) # our clock object clock = pygame.time.Clock() x1 = 0. x2 = 0. # speed in pixels per second speed = …

Member Avatar for Beat_Slayer
0
208
Member Avatar for gunneronaspooky

I've built my fair share of computers and figured it was time to learn to take advantage of that hardware by learning to program. So I'm taking some courses online. I'm having some issues writing some programs though, so any help would be appreciated. Right now, I'm stuck on this …

Member Avatar for gunneronaspooky
0
131
Member Avatar for Peter_TARAS

Hi! I am using a label widget in order to display a n rows and m columns matrix. My program allows repeated generation of a random matrix of integer (of arbitrarily number of rows and columns) - I am observing these matrices by representing them in a Label type widget. …

Member Avatar for Peter_TARAS
0
11K
Member Avatar for BigHappyGod

Here's the problem. Bought a new wireless printer, HP B209a. Have a wireless router, Belkin, been using it for years. I take it, the printer, out of the box, follow all the instructions on setting it up, run the setup program in a laptop, following all on screen instructions. It …

Member Avatar for Beat_Slayer
0
494
Member Avatar for Delu:sional

Im pretty new to Python (2.7) and no programming experience before. Anyway Im in the process of learning python but have a mysterious error that I can't figure out. Whenever I put equal sign in print statement, I get syntax error. here's an example code [CODE]def main(): f = open('lines.txt') …

Member Avatar for Delu:sional
0
146
Member Avatar for UaBoy

from random import randint correct = 0 for i in range(10): n1 = randint(1,10) n2 = randint(1,10) prod = n1 * n2 ans = input('What's %d * %d? ' % (n1,n2)) if ans == prod: print('That's Right! Well done.') correct = correct + 1 else: print('No, I'm afraid the answer …

Member Avatar for UaBoy
0
123
Member Avatar for remomore
Member Avatar for kumarantechie

Hi, I am a beginner in linux . i am using matchbox virtual keyboard for an application now i want to change the layout to another langauge . How to do it? Is there any way to change the layout from terminal . Kindly advice me suggestions. Any help appreciated …

Member Avatar for deimusmeister
0
152
Member Avatar for GothLolita

Hi everyone! I'm a newbie here. I have a problem: I need to create the address book in python that include name, phone number, email, address, etc...The information in the address book can able to delete or change. I will give more information later! Can you help me? I need …

Member Avatar for techie1991
0
2K
Member Avatar for gsenthil25

Hello, I'm trying to call a Python module in Java application using JEPP. I'm able to invoke the python modules from java Appl, but i'm not able to call the modules in python class from java appl. Python Code Code: [code] class SampleClass: def [b]callPythonModule[/b](self): print 'The Python Class module …

0
28

The End.