15,181 Topics
| |
[code=python]def main(): print (" PC : Hi there.whats your name?") userit = raw_input (" user :") print (" Pc : Nice to meet you " ) , userit , userit = raw_input(" Do you like python? (A=Its Great, B=Its Ok, C=Its Rotten)") if userit == A: userit = userit.upper() print … | |
python program to engage a user in conversation.requirements are a. firts question should ask the user for name .this name should then be used with the following questions b.Ask 4 more questions c. Each question should have 3 possible answers.That us option A,B or C(only) d. Have a different comment … | |
how can threading in python help me in my traffic simulation project? can i use it to detect other cars? | |
[ATTACH]9572[/ATTACH] Hello basically ive parsed a website's data into an object. I wrote it to file and read it back in to write to a dictionary. but when i read it in it reads it like 3 times. so im a bit confused as to why ad would like to … | |
[B]I have a text file that contains multiple records. Within the records, I am able to locate the line containing the desired text and read it into a string. Inside the line, I know the number of the starting character for the words I need. The length of the substring … | |
Hey guys I have to create a python version of Tic Tac Toe, but does anyone know if it's possible to make this using Tkinter? I think I have to have it nice and bright and colourful, therefore TKinter is the only solution i can think of using Python. Any … | |
Hello, I am trying to make a desktop icon for a newbie script I wrote while Teaching myself Python. I wanted it to be a clickable desktop icon for OS X. Plus, I guess I can use Icon Composer to make it a pic. Any ideas?! Thanks... | |
| hello, i just started a paper round and ive started doing what i do best : obsessing about it and i want to know if there is any way that i can open and close images of the different newspapers to learn them? i would prefer to do this with … |
There is a html page that has a form on it, with a text field named "text". When you enter text into that that field and submit it, it goes back to the python server, gets processed, and a new html page is sent out in response. I'm working with … | |
Hi I am desperately trying to get the text from a chat window. My idea was to use win32gui.GetWindowText(). I wrote a program to display any text with win32gui.GetWindowText() by iterating over all past and previous handles and as deep into each handle as there are children. Basically I tried … | |
I'm writing an application that needs to store a ton of objects and some attributes. I was wondering, based on python's inner workings, if it's more memory efficient to have one huge dictionary or many small dictionaries and then one dictionary that just references the smaller dictionaries? Any information would … | |
Hello python is my first language, and i have read 1 book on it and gone through a tutorial, but i still don't feel like i have a firm grasp on python. I hear the best way to master a programing language is to actually program. So i want to … | |
[ICODE]def selsort(l): if len(l)<=1: return l else: for i in range(len(l)): selsort(l[1:]) [/ICODE] Hey guys, this is what I have so far. I have trouble understanding recursion. Anyone know how to use it to do selection sort? | |
I tried really hard on this one, finally came up with this, however, there's space between every number in my result because of the code 'print xxx,' , I want to find a way to delete those spaces. Program: let user enter say 555-GET-FOOD, convert it to 555-438-3663 [CODE]alph = … | |
hi! i want to write a ftp server. i started writing: [CODE] from socket import * server= socket(AF_INET, SOCK_STREAM) server.bind(("0.0.0.0", 21)) server.listen(5) while(1): (client_s,client_addr)=server.accept() command=client_s.recv(1000) print command client_s.close() [/CODE] i run it and wrote in the internet explorer: [url]ftp://localhost[/url] but nothing happen.. it doesnt print the recieved command. what can … | |
Hi. I just started python programming tonight and am trying to use good practices such as list comprehensions etc. However, I'm trying to get a list of all files in a directory (and subdirectories) and only add the filename to my list if its extension matches one of the extensions … | |
Hi folks, Just hoping someone can point me in the right direction with this one. Say I have these key:value pairs in a dictionary, d1: [CODE="Python"] d1 = {fruit:['apples', 'bananas','oranges','tomatoes'], vegetables:['carrots','lettuces']} [/CODE] And I wanted to remove a list (containing tomatoes, oranges) from the value of the key fruit and … | |
Dear All, Everytime i want to logg off or restart to set python path so how to avoid this logg off or restart options. Actually iam using two Softwares using this different Pythonpath if iam using second software means again i want to restart Pc how to avoid this Situation. … | |
hi, Im running debian/ubuntu linux and am trying to get a script/module that runs each time python is called from terminal. I am trying to write scripts that use Scipy,numPy,pyLab, etc and am trying to have all those packages import automatically each time python starts. I am not new to … | |
Hi, I am downloading url using urllib2, the problem I am facing is some times server goes down and then read will take indefinite time. I dont want that, I want to raise a exception after 20 secs in this case. There is solution using signal.alarm but it works only … | |
Hello Python gurus! I need to subclass the built-in type "int" and to add a method that resets the value to what it was when the class was first instantiated. here is what i want to achieve: a = my_int(4) print a ---> prints 4 (works ok) a += 5 … | |
How to rename a file name using python script. Thank u in advance | |
I would appreciate any help with the following exercise, I have no idea how to really start this it'd not like any of the previous exercises I've done so any help would be great :) Define a class Set that keeps track of a collection of distinct objects. Inernally, you … | |
Hello All ! I m writing a scanner in python. I ve achieved to write scan results into a word file. But still not achieved to view results in my text box. My Text Box Codes: ----------------------------------------------------------------------------------------- metin = Text() metin.place(relx=0.3, rely=0.4, width=300, height=300) ----------------------------------------------------------------------------------------- A part of my Scanning … | |
file f:\\pulldpto.ini hold following data... 101;Activaciones;Virginia Aláez;C/ Isabel Colbrand, 22 , Edif D Planta 4º ;28050 ( Madrid) what will be out put of variables. [python] fINI='f:\\pulldpto.ini' fINI=open(fINI,'r') while 1: linea=fINI.readline() if not linea:break linea=string.split(linea,';') variabl1[string.strip(linea[0])]=0 variable2[string.strip(linea[0])]=string.strip(linea[1]) fINI.close() [/python] | |
Consider the following script [code=python] #!/usr/bin/env python # foo.py import sys print sys.argv [/code] When I run this in a terminal with arguments, here is the output [code] $ ./foo.py -h hello -m "this is a string" ['./foo.py', '-h', 'hello', '-m', 'this is a string'] [/code] My question is: is … | |
Does anyone here have a wxPython code that converts a folder of images to a .wmv file just by clicking a button? What I did in my program was I load an Image-to-Video Converter Software by clicking a button but I feel that it would be better if I can … | |
What is the easiest way to search a text file for a particular string? I have text files resembling the following : FILE A HAS 2266 LINES OF WHICH 951 WERE IGNORED FILE B HAS 2193 LINES OF WHICH 878 WERE IGNORED THERE WERE 2 DIFFERENCES Can anyone help me … | |
Hello, I have just started learning Python. Please can you tell me if there is a way to read in a file one bit or byte at a time (i.e. in binary). Thank you! | |
is pygame used for games only? or it is used for some application like traffic simulation? can we produce a slide bar in pygame? |
The End.