15,179 Topics

Member Avatar for
Member Avatar for jingo1126

im currently running on windows 7 and i cant seem to find some suitable installation of mysql for python 3.1.2.. any help on this?my professor havent gave me any links on where to download it, anyone would mind helping me on this? or as i tried import mysqldb and i …

Member Avatar for Reverend Jim
0
107
Member Avatar for Roelof Wobben

Hello, I have this code : import urllib import zipfile import re totaal = 0 commentaar = [] lus = True image = urllib.URLopener() image.retrieve("http://www.pythonchallenge.com/pc/def/channel.zip","channel.zip" ) bestand = "readme.txt" zf = zipfile.ZipFile('channel.zip') while lus == True : for filename in [ bestand ]: try: data = zf.read(filename) except KeyError: print …

Member Avatar for Reverend Jim
0
120
Member Avatar for Thropian

I've been doing programming in tkinter for awhile now and I came across a problem...this problem only shows up after a single part but here is the code...kinda lengthy.if you go to the equip menu and equip bare neck you can't change necklaces again. any help in shortening this or …

Member Avatar for Thropian
0
4K
Member Avatar for tpkemme

so now that i have gotten farther in the code, it prints the substrings correctly, but i can't get the program to stop correctly. basically, i'm looking for the longest common substring. def main(): input1 =raw_input('Enter string: ') input2 = raw_input('Enter second string: ') if input1 > input2: str = …

Member Avatar for TrustyTony
0
146
Member Avatar for otherdummy

Hi, I have just started my first semester in a Bachelor program 'Computer Engineering'. I have above basic knovledge in Java SE and currently am interested in Python. The problem is that I'm facing some difficulties in determing my purposes about my future career in IT field. I used to …

Member Avatar for etftw
0
248
Member Avatar for ddalgibbang

Hello Please excuse my lack of knowledge to python, but I just cannot understand how time complexity works. I've read many threads on this forum regarding time complexity but I am still quite confused. Our prof has given us this example: [CODE]def foo(n): ! while (n > 0): ! ! …

Member Avatar for Gribouillis
0
112
Member Avatar for tpkemme

I have a pretty simple coding function that returns all possible substrings of a string including the string itself def main(): str = raw_input ("Enter first string: ") size = len(str) for sub_len in range (1, size + 1): for idx in range (0, size - sub_len + 1): sub_str …

Member Avatar for TrustyTony
0
135
Member Avatar for ganeshredcobra

am using debian lenny and tried to create a shutdwon script using python import os os.system("sudo shutdown -h now") i cant use this in debian lenny then how will i implement

Member Avatar for Gribouillis
0
2K
Member Avatar for techie1991

Can someone please direct me to the code for the class <int> in python. I know that it must have written in C, but I could not understand, where to ask this query. Though I tried to figure it out myself, but could not even understand, which folder to attack …

Member Avatar for techie1991
0
154
Member Avatar for Roadphantom13

Hello everyone. This is my first post so if something doesn't work, bear with me. I'm a beginner at python and tried to write a program that will calculate Average Word Length. I wrote what I thought should work but the final answer keeps coming out to an average of …

Member Avatar for forsakenedzero
0
5K
Member Avatar for Roelof Wobben

Hello, I have a image with a grey band in it. How can I know the values of only the grey band of the image ? Roelof

0
65
Member Avatar for dustbunny000

So I have this list of strings. They all of the strings have a 18 capital letters. I want to assign each letter a value and them sum up the total score. [CODE]window=['SALHWRAAGAATVLLVIVL', 'ALHWRAAGAATVLLVIVLL', 'LHWRAAGAATVLLVIVLLA', 'HWRAAGAATVLLVIVLLAG', 'WRAAGAATVLLVIVLLAGS', 'RAAGAATVLLVIVLLAGSY', 'AAGAATVLLVIVLLAGSYL', 'AGAATVLLVIVLLAGSYLA', 'GAATVLLVIVLLAGSYLAV', 'AATVLLVIVLLAGSYLAVL', 'ATVLLVIVLLAGSYLAVLA', 'TVLLVIVLLAGSYLAVLAE', 'VLLVIVLLAGSYLAVLAER', 'LLVIVLLAGSYLAVLAERG', 'LVIVLLAGSYLAVLAERGA', 'VIVLLAGSYLAVLAERGAP', 'IVLLAGSYLAVLAERGAPG', 'VLLAGSYLAVLAERGAPGA', …

Member Avatar for slate
0
182
Member Avatar for Overachievious

Hey, I am working on a program for my class where we are supposed to count the letters that occur in a given string, with decreasing frequency. For instance, it would say there are 150 A's, 234 B's, 25 C's, etc. Plus, it would then become possible to sort the …

Member Avatar for TrustyTony
0
222
Member Avatar for Shadow-Illusion

I am trying to insert data from a text file into an SQL table. I'm getting this error: " csv_data = csv.reader(file('TxtFile1.txt', 'r')) TypeError: 'list' object is not callable " [code] import MySQLdb, csv, sys conn = MySQLdb.connect (host = "localhost",user = "a", passwd = "b",db = "c") c = …

Member Avatar for djmagba
0
3K
Member Avatar for G_S

Hello, Now I'm making a program for creating language glossaries, but the problem is that windows uses ANSI for encoding text files, and the program that will read these files (which is not mine) only displays words in utf-8 encoding. Since my program is multiplatform, it can also work under …

Member Avatar for woooee
0
7K
Member Avatar for evertron

I have the code below and I get everything except the bonus in the output. I tried it a few different ways and the bonus never comes out right after the staff and sales. #get user input for sales bonuses and make calculations #print headers print" Sales Tracking Program" print …

Member Avatar for woooee
0
110
Member Avatar for KrazyKitsune

What is parsing and how do I use it? My guess is that parsing is something that locates a keyword in a statement. My guess, okay? I don't understand wiki. If it isn't, is there something that can locate something in a statement and do something if it finds it? …

Member Avatar for Gribouillis
0
145
Member Avatar for mikeyj9009

I need the output of the following code to be printed in a text file. So far it creates the text file, but it does not print anything in it. Any help would be appreciated. [CODE]def findSlope (x1, y1, x2, y2): rise = y2 - y1 run = x2 - …

Member Avatar for Gribouillis
0
326
Member Avatar for KrazyKitsune

If we have more than one if statement, is it possible to combine them? Like this: [code=syntax]x = raw_input("> ") if x == a: print "1a" elif x == b: y = raw_input("> ") if y == a: print "1y" elif y == b: print "1b" elif y == c: …

Member Avatar for griswolf
0
105
Member Avatar for novice20

hi...i am trying to install python 2.6 on my debian system.. I followed the following instructions[B] [url]http://www.fps-gamer.net/installing-python-2-6-on-debian-lenny/[/url] [/B] on doing [B]aptitude install -t testing python-central[/B] i get [B]E: Invalid record in the preferences file, no Package header[/B] can any body pls reason out:(

Member Avatar for Gribouillis
0
780
Member Avatar for redyugi

This is used for finding the roots of a parabola. The parabola must have a number in front of x2 (x squared), a number in front of the single x, and a following number, or you can have a perfect square parabola. (in the form "number x2 - number") This …

Member Avatar for redyugi
0
436
Member Avatar for neely615

I am new to this forum (and python), but since I found excellent post here, I figured it would be the best place to post this question which is two part: I have many (+100) .txt files which are space delimited (not csv or tab, possibly referred to as ASCI?) …

Member Avatar for neely615
0
575
Member Avatar for Gribouillis

The with statement allows all sorts of syntactic sugar in python. This snippet defines two contexts: [icode]inevitably[/icode] and [icode]preferably[/icode] which register a function call to be executed at the end of a block of statement. Although they are not very useful (the function call could be written directly at the …

1
539
Member Avatar for dustbunny000

Hi. I was wondering if anyone knows how to establish x,y,z coordinates in python. I want to be able to extract this data from a text file. Here are sample lines in my text file: [CODE] ATOM 1 N GLN A 4 62.131 49.287 59.621 1.00 67.10 N ATOM 2 …

Member Avatar for TrustyTony
0
830
Member Avatar for group256

Hello everyone, It's about a week that I have started to learn Python, and I am planning to design and code a simple chat server, with a bunch of clients as a practice. I have seen the easiest implementation of such program on the net(just google: "Simple chat server in …

Member Avatar for python01
0
150
Member Avatar for communitygirl90

So I'm pretty new to using python and a beginner. I've written a code on how to figure out the length of 2 polylines and now I'm trying to figure how to display the data using canvas... I've tried like a million times and I just can't get it to …

Member Avatar for strider1066
0
159
Member Avatar for doctorjo5

I am trying to make a number guessing game in Python. The correct number is 42. Right now I have it so that it gives you a message when you are too high, too low or right on. I want to add two other messages. One message for no input …

Member Avatar for Schol-R-LEA
0
216
Member Avatar for Brutus2000

Hi, I have some problems just to write a simple string output to some txt.file. That is my test code: [CODE]test = open('Test.txt', 'w') test.write("Teststring") test.close()[/CODE] I use Python 2.6.5 and PyScripter If I direcly enter the code in the IDLE SHELL, sometimes it works, sometimes only the file is …

Member Avatar for d5e5
0
98
Member Avatar for PaulStat

Hi Folks, I have a set of csv files that I open and read the contents of a row into a DictReader, this works fine 99% of the time, but occasionally one of the fields in a record has an extra new line character. For example here's the format of …

Member Avatar for d5e5
0
2K
Member Avatar for Ashena

I have a file that has a repeated number of blocks of different sizes as in below: ID: 2 Time: 76 Op: GET Domain: facebook.com LPath: /common/css/common.css Referer: [url]http://google.com[/url] User-Agent: Mozilla/4.0 ID: 3 Op: GET Domain: rfi.fr LPath: /common/css/common.css Referer: [url]http://yahoo.com[/url] For each block, I want to print only the …

Member Avatar for TrustyTony
0
14K

The End.