15,181 Topics

Member Avatar for
Member Avatar for Robbert

Hi Any one know how I can get the following function to return a value - thanks. [CODE]import threading import time def stringFunction(value): str = "This is string no. " + value return str thread1 = threading.Thread(stringFunction("one")) thread1.join() thread1.start() while threading.activeCount()>1: time.sleep(1) print thread1 [/CODE] Currently returns "<Thread(Thread, stopped)>" Not …

Member Avatar for sekmani
2
29K
Member Avatar for TrustyTony

This is one small snippet of after event usage. You could express if you find this kind of simple code to be usefull as snippet. Notice also vegaseat's sticky message threads in begining of Python forum in addition to code snippets.

Member Avatar for Gribouillis
0
5K
Member Avatar for mohammed_41

how to import datafile using numpy ? i did the following : import numpy as n filename='data_file.txt' data=n.loadtxt('data_file.txt') but it is bot working ?

Member Avatar for Gribouillis
0
216
Member Avatar for monsterTUT
Member Avatar for Rasmus_2
0
193
Member Avatar for funfullson

hi.I want play linux shells command with python.for example i did it: [CODE] def add(userName, pasword): import os os.system("useradd -d /home/%s -m -p %s %s"%(userName, pasword, userName)) [/CODE] but some where i have problem. for example when you want change the users password you have to send the command for …

Member Avatar for Krystor
0
2K
Member Avatar for Krystor

Hello everybody! Today i am writing a program to connect usées without database, with only one function: `createaccount(username,password)` That you must write on the beginning if the program. But i don't know how to finish it, with the "connect" function : class User(): def init(self, inputusername="a", inputpassword="b"): self.username = str(inputusername) …

0
242
Member Avatar for vegaseat

PySide (public license PyQT) is my preferred Python GUI toolkit. Here we explore how to test some of the widgets available and create a digital clock.

Member Avatar for Gribouillis
3
2K
Member Avatar for karmstrong

0 down vote favorite I have created a network scanner, that looks for a specific port on a range of IP's. I would like to thread the application but I am getting and error message ERROR: for worker in range(network.hosts): TypeError: 'method' object cannot be interpreted as an integer Now …

Member Avatar for rproffitt
0
1K
Member Avatar for V3N0M

I am trying to write some code for project euler problem 10, in which you are required to find the sum of all the prime numbers less than 2 million. Now the code is taking too long to execute. I would like to know how can I improve my code …

Member Avatar for filtre
0
456
Member Avatar for Haranadh

I would like to know Which are the python data structures uses divide and concur algorithm? Please explain me?

Member Avatar for rproffitt
0
323
Member Avatar for adanaz

I am making a text adventure and would like the command line window to be a specific size when you run the .py file in the command line window. eg. 300 wide by 250 height. I found a thread on here that shows how to specify the text colour which …

Member Avatar for DubWine
0
18K
Member Avatar for ben.juarez.773

Hello! I am looking for some help, and have provided the code. I'm just trying to do some simple stuff. I'm trying to create a simple game without using classes (but using lists). What I'm trying to do is create collision detection among list objects ("bullets" and "baddies"), as you'll …

Member Avatar for a_9
0
710
Member Avatar for Eric_8

I have a folder with 40 files in it which I want to loop through. When I print out the name of the file my code works fine: import os source = 'pathtofile' for root, dirs, filenames in os.walk(source): for file in filenames: print file It will print : File1 …

Member Avatar for Eric_8
0
14K
Member Avatar for Eric_8

Hi, I am fairly new to Python. I am familiar with the concept to pass data accross functions. In theory, def c(): r = raw_input("Ask Something? ") .. return r def p(x): ... do something r = c() p(r) The code below works just fine via Terminal ( python filename.py …

Member Avatar for Eric_8
0
329
Member Avatar for manyatha

input1: create external table db.emp(id int,name string) row formatted fields terminated by ',' location 'hadfs:.../'; create external table db.emp1(id int,name string) row formatted fields terminated by ',' location 'hadfs:.../'; input2: create table db.emp(id int,name string) location 'hadfs:.../';; create table db.emp1(id int,name string) location 'hadfs:.../'; requeried output: create external table db.emp(id …

Member Avatar for rproffitt
-1
368
Member Avatar for Hubert_2

Hello Need help. I try to insert a background sound in my program but I get ImportError message Below line 8 and 9 of my program import random, time, pygame, sys from pygame.locals import * Below the error message when running my program #C:\Users\user pc\AppData\Local\Programs\Python\Python35-32\python "C:\Users\user pc\SkyDrive\ISN\son essaie.py" #Process started …

Member Avatar for DeanMSands3
0
172
Member Avatar for Jesse_11

I need to make a timer for pygame to sit in the top left of the screen, but have no idea how. I want it to count down from 30secs to 0. please help cause I have no idea.

Member Avatar for DeanMSands3
0
505
Member Avatar for Nether_1

I'm attempting to write a code in which the user can add as many of a certain object as needed, and blit it on to a pygame window. Essentially a game engine of sorts. I need to make it so that they can add as many of these objects as …

Member Avatar for Gribouillis
0
565
Member Avatar for kiyo_1

i put this code:: matirial = raw_input ('what is your favorite lesson') if matirial == 'maths' or 'math' or 'Maths' or 'Math' or 'رياضيات': print 'like me broo!!' elif matirial == 'french' or 'francais' or 'French' or 'Francais' or 'الفرنسية': print 'sorry dude I love English more then french' elif …

Member Avatar for samson.dadson.3_1
0
229
Member Avatar for vegaseat

This code creates a sound file in Sun's simple AU audio format of a sine wave of given frequency, duration and volume.

Member Avatar for samson.dadson.3_1
1
2K
Member Avatar for Lynet
Member Avatar for omprakash_1

# Split a dataset based on an attribute and an attribute value def t_split(x, y, z): l, r = list(), list() for row in z: if row[x] < y: l.append(row) else: r.append(row) return l, r # Calculate the Gini index for a split dataset def gini_index(grp, class_values): gini = 0.0 …

Member Avatar for rproffitt
0
324
Member Avatar for Mae_3

I tried making a code that displays images in a tkinter window along with a text underneath however its positioned in the top but I want it in the center. The path "C:\Users\ariel\Desktop\arrayofimages.txt" has: > C:\\Users\\ariel\\Pictures\\photoimage1\\1.jpg > C:\\Users\\ariel\\Pictures\\photoimage1\\2.jpg > C:\\Users\\ariel\\Pictures\\photoimage1\\3.jpg > C:\\Users\\ariel\\Pictures\\photoimage1\\4.jpg > C:\\Users\\ariel\\Pictures\\photoimage1\\5.jpg > C:\\Users\\ariel\\Pictures\\photoimage1\\6.jpg > C:\\Users\\ariel\\Pictures\\photoimage1\\7.jpg The path …

Member Avatar for rproffitt
0
3K
Member Avatar for Ace_4

# print ('Let me help you order a pizza. What size would you like?' ' a. small ($7.99) b. medium ($14.99) c. large ($18.99)') choice = input('Please enter a or b or c: ') prices = {'a':7.99 , 'b':14.99 , 'c':18.99} if choice == 'asdf' : print("Ok fam, you became …

Member Avatar for rproffitt
0
192
Member Avatar for Mirty

I need help with some questions.They were 20 of them but this 5 have been so hard for me. Any help I get will be highly appreciated. Cheers!!! 1.When mergesort is implemented on a linked list it is possible to implement it as a stable sort. True or False? These …

Member Avatar for Mirty
0
290
Member Avatar for vegaseat

Sometimes when you get a large check from your employer, the value is written out in words. I get those all the time of course. So I wrote this little Python code to convert an integer value to english words. Numbers as high as 999 vigintillion can be used. In …

Member Avatar for Abdullahi_2
3
11K
Member Avatar for kiyo_1

i put this code to now how to enter the name name = raw_input('eter your name') name = {} but i want the name that i input it please replied fast

Member Avatar for pty
0
92
Member Avatar for kiyo_1

i put this code name = raw_input ('please enter your name-->') print 'hello ' + name age = raw_input ('enter you age-->') if age < 5: print 'what the...how did you understand on me' elif age < 18: school = raw_input ('in wich school you are') print "I don't care" …

Member Avatar for Gribouillis
0
218
Member Avatar for Katarína_1

Hi, 1. I would like to ask how can I adjust array.csv like this: ,,,-00.000146400000, 0.08000, ,,,-00.000146200000, 0.00000, ,,,-00.000146000000, 0.00000, ,,,-00.000145800000, 0.00000, so I can have in first column -00.000146400000 and in second column 0.08000? (thanks, I am begginer). 2. How can I pick out information(number) from 20 separate files …

Member Avatar for Gribouillis
0
237
Member Avatar for john_beginner

Hello All, I am new in this language and want to access the run time value In other words, I want make a program in which ask the value from User like scanf() function in C and cin>> function in Cpp So is there any function or method by which …

Member Avatar for Reverend Jim
0
21K

The End.