15,194 Topics

Member Avatar for
Member Avatar for shanenin

I have been reading through the "python library reference" with no luck finding the module needed to copy a file. Any help would be appreciated.

Member Avatar for shanenin
0
247
Member Avatar for shanenin

I need root privledges to do some stuff in my python script. I am currently using this technique [php] current_user = os.geteuid() if current_user != 0: print "you need to be root to run this script" sys.exit()[/php] this will at least polietly end the script so i am able to …

Member Avatar for vegaseat
0
343
Member Avatar for danizzil14

Hello Everyone! My question is simple, where are any half decent tutorials out there? I mean, all of the ones I've tried have only skimmed the surface(print, name = raw_input yah know things like that)- or were way to complicated. I've only been doing this for something like a week

Member Avatar for danizzil14
0
149
Member Avatar for Flinch

Hello, I am relatively new with Python and Pygame, however, I am an experienced PHPer, so programming isn't something new to me. My problem is this: I got Python 2.4 installed and Pygame 1.6 for Python 2.4 installed. I know Pygame works because I can make calls to the Pygame …

Member Avatar for vegaseat
0
744
Member Avatar for iacobus2

I just want to say that I am very disappointed with Guido van Rossum's latest tutorial. I like to follow along typing in the examples and seeing how they run. I seem to catch on to things better that way. But this tutorial's examples haven't been throughly checked because some …

Member Avatar for shanenin
0
203
Member Avatar for madgokuss4

I have been working on some python code with a friend and for some reason i keep getting this message when i try to run his code, if ar[2]!="client": IndexError: list index out of range I can't see whats wrong and i have never had this message come up before??

Member Avatar for madgokuss4
0
285
Member Avatar for danizzil14

Hello all! Ok here's my problem: I have a Hello World type program that I want to run in steps, and each step is in a new window. When a "next" button is pressed the old window terminates and a new one is created. Now I don't know much about …

Member Avatar for vegaseat
0
177
Member Avatar for danizzil14

Ok, I've only been working with Python for something like 4 days now and I'm stuck trying to do a certain thing in Tkinter. Now, just to get you into the situation here. I've created a little program that has an entry bar and a go button. It says for …

Member Avatar for vegaseat
0
161
Member Avatar for danizzil14

I have heard that it is possible to compile python so that people reciving the script don't need to worry about going to the python website and downloading it. One more thing if you tell me to run something from the prompt I can't for the life of me run …

Member Avatar for vegaseat
0
168
Member Avatar for koolhead17

python -------------------------------------------------------------- [url]www.python302.tk[/url] [email]python302@gmail.com[/email] -------------------------------------------------------------- ALL FOR YOU SPIDY -------------------------------------------------------------- Disclaimer: This paper is not to be copied, or used on any website without my permission, consequences will occur if it has been found on ANY website. Only time it is allowed to be used on a website is with …

1
135
Member Avatar for shanenin

I am slowly absorbing these python class concepts(kinda) this fails with an error [php] class Critter(object): def __init__(self): print "I am born" def talk(self,name): self.test = name print self.test crit = Critter('ralph') crit.talk()[/php] this one works [php] class Critter(object): def __init__(self,name): print "I am born" self.test = name print self.test …

Member Avatar for vegaseat
0
213
Member Avatar for nephish

Hey there all, i have a question about how to point my python install to my sql database. when i enter this:[CODE] db = MySQLdb.connect(user="user", passwd="pass", db="myDB")[/CODE] i get this: [CODE]Traceback (most recent call last): File "<pyshell#1>", line 1, in -toplevel- db = MySQLdb.connect(user="user", passwd="pass", db="MyDB") File "/usr/lib/python2.4/site-packages/MySQLdb/__init__.py", line 66, …

Member Avatar for nephish
0
150
Member Avatar for Rete

I was wondering if there was any way to make a for loop go through a string word by word, rather then character by character. For example, [B]for letter in "Hello world"[/B] [B]print letter[/B] it would print out H e l l o etc. I was wondering if I could …

Member Avatar for Rete
0
163
Member Avatar for Lee Bel

Hello!! Does anybody know how to create a function that randomly changes elements in a string? And: does anybody know how to set the chances for the type of changes? I've tried to look it up in tutorials, but since I'm a beginner, most of the time creating random outputs, …

Member Avatar for shanenin
0
198
Member Avatar for Rete

Sorry, I know that this is probably the wrong section to post this question in, but I'm sort of confused as to which one would have been appropriate. Anyways, I've been using regular expressions to find specific information such as e-mail addresses and whatnot inside textfiles, but I can't get …

Member Avatar for Rete
0
227
Member Avatar for -=disAbled=-

I'm trying to finish up my first Python program. The program was built to help me maintain and add content to my webpage (it's nothing fancy...just pure html). Everything was smooth sailing (hey, python kicks some serious butt), until I ran into problems using retrbinary() to download files. The problem …

Member Avatar for -=disAbled=-
0
485
Member Avatar for shanenin

I just finished my first program, other then a few test ones. it is tic-tac-toe. If you want to try it. here is the link [url]http://webpages.charter.net/lindbergfamily/game.py[/url] It is not very advanced, just mainly a bunch of if then and while statments. If any of you care to comment on my …

Member Avatar for vegaseat
0
1K
Member Avatar for stupidenator

Hey all, I am very new to python, but I hear that it can be used to handle web forms. Does anybody know of where I can find a good tutorial on how to create something that will handle form input? Thanks in advance. -Nick

Member Avatar for nephish
0
334
Member Avatar for nephish

i have an html form with a drop-down list that lists a bunch of images. how can i get my cgi script to load the image ? i have imported cgi and os text entered from a form and read from a file do ok, but i cant seem to …

Member Avatar for nephish
0
239
Member Avatar for nephish

hey there, i have written a script that gets my email messages, but i need to be able to strip off all of the stuff except the body of the message so i can write that to a text file. is there an easy way to do this ? Edit/Delete …

Member Avatar for nephish
0
215
Member Avatar for shanenin

I do not understand why the instructions are being printed off of the margin(about 5 spaces). I would think they would be directly on the margin. I am talking about this part in particular [quote] you first need to choose to go first or second. If you choose to go …

Member Avatar for vegaseat
0
182
Member Avatar for shanenin

I am getting really tired, so I am probably doing something dumb(disclaimer). below is a python function I am trying to test [php] # answer.py # # this function asks for a move and checks to see # if it is a legal place to choose. position = ['X','O',' ',' …

Member Avatar for shanenin
0
230
Member Avatar for iacobus

Hello, Now that I have been instructed as to how to write unicode characters in Python, I would like to know if it is possible to get the unicode characters into a list, dictionary, etc. Here is my very simple code: [code]a = u'\u05e9\u05dc\u05d5\u05dd!' print a print print mylist = …

Member Avatar for iacobus
0
348
Member Avatar for iacobus

Hi all, I am trying to learn unicode relative to Python, but to be honest, I'm floundering a whole lot. I have never had so much trouble with anything before, but to put it simply, I just don't get it. For example, I want to use Hebrew words in my …

Member Avatar for iacobus
0
196
Member Avatar for shanenin

from my understanding, a list can do everything a tuple can do plus more. The big advantage of using a list is you can change elements, lists are mutable. Are their situations where a tuple is preferable to a list?

Member Avatar for vegaseat
0
178
Member Avatar for shanenin

I am trying to follow this code I am reading in a book. First I will show you the code as the book has it. This is for a word jumble program. This algorythm I am refering to jumbles a word [php] import random # create a sequence of words …

Member Avatar for shanenin
0
200
Member Avatar for stupidenator

Hi everyone. This is my first post in the python thread and I am very new to the language. A while ago, i wrote a program that find the least common denominator for an array of numbers in Java. I recently started to look at the python language and I …

Member Avatar for stupidenator
0
237
Member Avatar for nephish

Hey there, i have a python cgi script that prints out html just fine in the Opera browser but doesnt print at all under FireFox. weird, eh? i am getting nothing in the apache logs about any error. perhaps its a firefox issue, but i doubt it. any suggestions. simple …

Member Avatar for nephish
0
159
Member Avatar for shanenin

here below is my code [code] #!/usr/bin/python #this is my third python script print \ """ this is a python program to figure out total sales price, including tax\n\n \t\t\tprogrammed by\n \t\t\tShane Lindberg\n\n """ base_price=int(raw_input("please enter the base price of the car:\n$")) under_coat=int(1000) stereo=int(200) air=int(750) tax=int(base_price*.07) print "the total price …

Member Avatar for shanenin
0
191
Member Avatar for nephish

Hey there. Here is the deal.... i have a script that is supposed to open a file based on criteria from a web form. i cant seem to get it to work though. here is the code: [CODE]form = cgi.FieldStorage() DataRecord = form['DataTime'].value Customer = form['CustName'].value # should be automatically …

Member Avatar for nephish
0
171

The End.