First of all please us code tags.
In your counter2 function there are a couple errors. Why are you passing 2 arguements to f.write()? Why are you passing an integer to f.write()? You should only pass a single string to that function.
Also, you shouldn't exit the main thread until all your chil threads have exited. You could do something like this:
[code=python]
import thread
import time
...
User Profile
Collapse
-
I think you can do that like this:
[code=cpp]
fseek(theFile, -x, SEEK_CUR); // moves position back by x
[/code]...Leave a comment:
-
I dont really understand what you mean. Do you want to add the code from program 2 to program 1 at the end or something else? Also, what is the error message you are getting?...Leave a comment:
-
I'm not sure but the problem might be because of the space in the path. Try calling it like this:
[code=python]
open/os.system('"\\N OTEBOOK\\...... \\a.wma"')
[/code]...Leave a comment:
-
You should check to see if i.id and q are the same type (3 != "3")....Leave a comment:
-
What result did you expect to get?...Leave a comment:
-
This is a neat little function that does what I think you want:
[code=python]
def indexList(s, item, i=0):
i_list = []
while True:
try:
i = s.index(item, i)
i_list.append(i )
i += 1
except:
break
return i_list
[/code]
P.S. Did you take a look at the responses in your other thread? I...Leave a comment:
-
Ok you need to check if the letter is in the word and then if it is replace the star in the position of the letter with the actual letter:
[code=python]
def indexList(s, item, start = 0):
return [i+start for (i, let) in enumerate(s[start:]) if let == item]
base = "******"
word = "python"
letter = raw_input("Ente r a letter: ")
if letter in word:
lbase...Leave a comment:
-
Try calling DisplayMenu like this:
[code=c]
DisplayMenu(c);
[/code]...Leave a comment:
-
Like this?
[code=python]
import random
myList = [1, 2, 3, 4, 5, 6 ,7, 8, 9,10]
print random.choice(m yList)
[/code]...Leave a comment:
-
Like this?
[code=python]
def geomean(num_lis t):
return sum(num_list) ** (1.0/len(num_list))
[/code]...Leave a comment:
-
That means exactly what is says. You only defined ipAdd locally in one of your functions. You either need to pass it in to ping or maybe it's not so good using functions like that. Maybe like this:
[code=python]
ipAdd = raw_input("Ente r primary IP: ") # you would also validate this
secondaryIPS = []
while 1:
ipAdd2 = raw_input("Ente r secondary IP: ") # again validate this
secondaryIPS.ap pend(ipAdd2)...Last edited by bartonc; Oct 24 '07, 07:51 PM.Leave a comment:
-
Ok do you know how to declare and fill an array?
[code=c]
double powersOf2[6];
powersOf2[ind] = value;
[/code]...Leave a comment:
-
I think you need to make your program accept command line arguements and then call the program with those command arguements....Leave a comment:
-
Please post what you have tried on that and be a little more specific....Leave a comment:
-
[code=python]
if grade >= 70 and grade < 80:
print studentname, grade
// or...
if 70 <= grade < 80:
print studentname, grade
[/code]...Leave a comment:
-
You could do something like this:
[code=python]
import urllib
pg = urllib.urlopen( "http://www.kitconet.co m/charts/metals/gold/t24_au_en_eukg_ 2.gif")
data = pg.read()
f = open("myGoldPic .gif", "wb")
f.write(data)
f.close()
[/code]
And then you can use myGoldPic.gif as your image file....Leave a comment:
-
The reason why it didn't work your original way, is because you were testing to see if a tuple (it doens't make a difference what it contains) is in a string. You need to test individually for every string in the tuple if it is found in the user input....Leave a comment:
-
You could try something like this:
[code=python]
bit = 0
for word in bad:
if word in response:
bit = 1
break
if bit:
print "Bad language"
[/code]...Leave a comment:
-
No activity results to display
Show More
Leave a comment: