15,181 Topics

Member Avatar for
Member Avatar for Mike_11

Hi, this is my code for Python: [CODE]granted = False for count in range(10): password = raw_input('Please enter a password: ') if password == 'thepassword': granted = True break print 'You have entered invalid password %i times.' % (count+1) if granted: print 'Access Granted' raw_input('Press ENTER to continue...\n') else: print …

Member Avatar for richieking
0
754
Member Avatar for maf_9000

i am building a simple sync program, whan the program starts it takes all the bandwith, i need to set the speed limit, i am using using ftplib [CODE] file = open(local_file_path, 'r') print ftp.storlines('STOR '+ file_name , file) [/CODE]

Member Avatar for Gribouillis
0
1K
Member Avatar for heavy.is.happy

Hi. I got two questions about wxPython! 1. Can python use Internet explorer 6 as webkit? Like Visual Basic.NET do. 2. Has python a webbrowserfunction who pause the program untill the page is 100% loaded? When continue.

Member Avatar for richieking
0
64
Member Avatar for tigrum

Hello everyone I haeve tried to understand the capabilities of python in web development. Have gone throuhg forums and online tutorials. Nevertheless I am not able to find any topic which can give me some insite along with basic examples of how to send http get data from an xp …

Member Avatar for serinformaticos
0
227
Member Avatar for Vengful

hello im new to python and im just making simple programs(for now) so im doing this guessing game where the user enter a number and tells him if he got it right or not. here is the code [CODE] import random import re print 'This is a guessing game' def …

Member Avatar for Vengful
0
93
Member Avatar for debasishgang7

I am trying to open multiple ports in a computer with PYTHON Sockets. Here is my code.. [CODE]import socket import thread from threading import * BUFSIZ = 1024 clientsock = socket.socket() def handler(clientsock,addr): while 1: data = clientsock.recv(BUFSIZ) if not data: break def function(): for n in range(1,5): var = …

Member Avatar for Tech B
0
1K
Member Avatar for TrustyTony

Next quiz is posted as code snippet. It is quite interesting code. What it does? And where [B]in your system[/B] you already have this code? (in little different format) (If you have not follow tip in page [url]http://python.org/download/[/url])

Member Avatar for TrustyTony
0
225
Member Avatar for Tomashqooo

[CODE]tomashqooo@Tomashqooo:~$ python Python/tcrack.py File "Python/tcrack.py", line 86 ostring2 = ostring2' -c 'station' mon0' ^ SyntaxError: invalid syntax[/CODE] That`s my error message when ostring2 and station are string variabiles and ' -c ' and ' mon0' is text. Please help me what`s the problem here???

Member Avatar for Tomashqooo
0
72
Member Avatar for debasishgang7

Hi all, Here is mu scenario.I am trying to open multiple port on a compute. I am trying to make the code multi threaded.So here is my code: [CODE]import socket import thread from threading import * s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def handler(clientsock,addr): while 1: data = clientsock.recv(BUFSIZ) if not data: …

Member Avatar for debasishgang7
0
894
Member Avatar for codemonster

The following is a class from a search engine program that I'm working on (via a text book). I'm attempting to modify the following code so that it will count the number of occurrences a user's entry has from a source. My initial attempts was to create a new method …

Member Avatar for woooee
0
89
Member Avatar for petzoldt01

Decided I want to use python for web programming. I am a fan of Lighttpd, but when it came to python, just seemed like apache had some better options. I am currently setup with Apache2 and mod_python. I use VirtualHost site configurations to serve a few websites, and do per-site …

0
73
Member Avatar for Checkerboz

Okay so as a complete newbie... Currently I am at chapter 6 of a book called How to Think like a Computer Scientist ([URL="http://openbookproject.net/thinkcs/python/english2e/ch06.html"]http://openbookproject.net/thinkcs/python/english2e/ch06.html[/URL]) and I for some reason can't figure out this exercise: Make this doctest pass: [CODE]def print_digits(n): """ >>> print_digits(13789) 9 8 7 3 1 >>> print_digits(39874613) …

Member Avatar for Checkerboz
0
117
Member Avatar for Thropian

I have a command lets say [CODE]f(x): print x[/CODE] I want to create several buttons to print various numbers so I made a list of the objects to print when I tried to do [CODE]for x in thislist: bind_all(x,lambda:f(x))[/CODE] which bound the buttons properly but all the buttons print the …

Member Avatar for Thropian
0
74
Member Avatar for SasseMan

Hi! I want to make a python program that runs different simple command line scripts. Right now I use os.system which works fine for running the scripts, but the problem is that the scripts sometimes halt and wait for input from the user. So my question is, how do i …

Member Avatar for Gribouillis
0
149
Member Avatar for ankurvit

Hi, I'm looking to code the following problem in python. If (for example) dict={A:0.7,B:0.8,C:0.9,D:2.3,E:0.1,F:2.4} and so on.. (i have a big dictionary of A-Z something like this) I'm looking to find repeated substring in a string that has a dissimilarity of no longer than 0.5 (between highest and lowest). The …

Member Avatar for TrustyTony
0
193
Member Avatar for clyt

I want to obtain the data from .dat file which contains millions records (most of them are string) with 52 fields. I am trying to store the data into 52 lists. However, it is very slow Here is the code: import sys try: file= open("test.dat", "r") except IOError: print >> …

Member Avatar for clyt
0
131
Member Avatar for Tugnus

So I'm pretty lost in Python. My teacher doesn't explain the commands for Python so I'm really confused on how to write this. I have to write a green screen type program that takes a picture with a green background and replaces it with another picture by looking at the …

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

I am writing Python on my mac, and am trying to pipe the output from the Terminal to python.. I think this is achieved with os.popen?

Member Avatar for FALL3N
0
113
Member Avatar for Hawkwing

If I have a class variable being passed to a function, is there a way that I can get the class that the variable is from? [CODE]class someclass: def __init__(self): self.somevariable='somevalue' def somefunction(self): print('gotta get here') def someotherfunction(somevariable): somevariable.needparentclasshere.somefunction() myclass=someclass() someotherfunction(myclass.somevariable)#this needs to print 'gotta get here'[/CODE]

Member Avatar for woooee
0
161
Member Avatar for Thropian

Ok so I'm trying to get images to resize which I could do with Image.PhotoImage but now I'm using RGBA .png files so I have to use ImageTk.PhotoImage and I can't figure out how to resize them anymore any help on this kind of thing? I'm using python,tkinter

Member Avatar for Thropian
0
14K
Member Avatar for Kirielson

Hello, I'm having trouble running the CalcOpticalFlowPyrLK in Python. When I try doing the calculations for the Lucas Kanade code it will not compute the error I get is the following:[ICODE] File "****", line 63, in callback (currFeatures, status, track_error) = cv.CalcOpticalFlowPyrLK(old_image, new_image, old_pyramid, new_pyramid, old_features, (3,3), 1, (cv.CV_TERMCRIT_ITER, 10, …

0
175
Member Avatar for Caraka

Greetings I'm running in circes trying to accomplish something very simple. I have a csv file with multiple lines resembling: 0002345, 24, 5, 0.24 I need this format in my output file: '0002345', 24, 5 0.24 The first entry is a census meshblock code and the leading zeros are relevant …

Member Avatar for Caraka
0
863
Member Avatar for AnjaliThukral

I have windows xp operating system at my home with python 2.5 and same operating system with python 2.4 at my computer lab. While working in python IDLE suddenly this error message --socket error:connection refused-- pops up and then python IDLE does not work at all.To make it work again …

Member Avatar for vegaseat
-1
1K
Member Avatar for Sinnocence

I wasn't able to find the link describing how to solve this. When I try to compile my program with py2exe using python v2.6 at the end of the process I get a message saying The following modules appear to be missing ['ICCProfile','_grabscreen','_imaging_gif'] my setup script is just : from …

Member Avatar for snippsat
0
195
Member Avatar for vegaseat

One more application of the Python Image Library (PIL). This short code creates thumbnails from all JPEG files in the current folder. The thumbnail image file is prefixed with a T_ and saved to the same directory. The program checks for existing files with this prefix, so we don't create …

Member Avatar for thenate
1
2K
Member Avatar for jmark13

Hello again, So, I'm trying to work out a problem where there are 6 symbols in a string (A, B, 0, 1, [, ]). The brackets always have to face each other in the string but they can be nested. There are some rules, most of which I have down, …

Member Avatar for TrustyTony
0
138
Member Avatar for Petan Kl

Hello, I am wondering if there is an efficient way (other than for cycle) of solving following task: I need to multiply e.g. two matrices and at every point in the matrix there is an array. The two matrices shall be multiplied using matrix multiplication and when the elements of …

Member Avatar for Gribouillis
0
211
Member Avatar for FALL3N

ok, I'm sure the answer to this is very simple.. there may even be some component in the os package to do this... I want to do what the code underneath seems like it would do.. I understand it does not, and when I try to run the code, I …

Member Avatar for FALL3N
0
276
Member Avatar for FALL3N

hello all, I have a program, and in it, it eventually specifies 'aFolder' to be os.walk(path/to/folder) how do I obtain inifo such as the name or the path of the folder, is it then the temporary current working directory?

Member Avatar for snippsat
0
111
Member Avatar for jml101

Hello All, New to Python, I keep getting an indentation error after the if (yescheck == todcheck): line. Any suggestions? As far as my python knowledge goes, I've got it correctly aligned, but clearly not. Could some of you try running this, see if it goes? [code=python] import os yesfile …

Member Avatar for vegaseat
0
714

The End.