15,181 Topics
| |
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 … | |
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. | |
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 ? | |
Hi guys I'm learning python. Give me a unique tip please :) | |
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 … | |
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) … | |
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. | |
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 … | |
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 … | |
I would like to know Which are the python data structures uses divide and concur algorithm? Please explain me? | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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. | |
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 … | |
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 … | |
This code creates a sound file in Sun's simple AU audio format of a sine wave of given frequency, duration and volume. | |
looking for a signature based intrusion based code in python | |
# 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 … | |
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 … | |
# 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 … | |
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 … | |
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 … | |
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 | |
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" … | |
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 … | |
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 … |
The End.