15,190 Topics

Member Avatar for
Member Avatar for JeyC

Are there python commands to achieve the following : 1. Create new text files 2. Write certain text to these file (similar to DOS Echo> command ???)

Member Avatar for Arrorn
0
132
Member Avatar for sharat87

Hello everyone! just dumped bytes forums and joined daniweb... hope its a good decision :P anyway, could you guys take a second to look at the following code... [code=python] import subprocess as sp cmd = "awk '{print $0}'" ex = sp.Popen(cmd.split(' '), stdin = sp.PIPE, stdout = sp.PIPE, stderr = …

Member Avatar for sharat87
0
4K
Member Avatar for harrykokil

how do I trigger a function after x seconds in pygame?? i have seen the "pygame.time.set_timer(event,ms), but i want to trigger a function instead of an event. hoping for a quick reply thanks...

Member Avatar for Arrorn
0
58
Member Avatar for Foxcow

Whenever I open Python I get Socket error: No connection could be made because the target machine actively refused it. Also I get IDLE's subprocess or personal firewall software is blocking the connection. I was wondering how to fix this?

Member Avatar for lllllIllIlllI
0
90
Member Avatar for lilkid

[ATTACH]9597[/ATTACH] ok i want to read this file into a dictionary and this is the output d={"flight":T34712, From:ABERDEEN, scheduled 0800, remark landed} etc flight is the key do i have to parse the text file i know i cant put it straight into the dictionary as i get this output …

Member Avatar for lilkid
0
160
Member Avatar for jessica2009

[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 …

Member Avatar for woooee
0
137
Member Avatar for shadwickman

Hello, I've loved Python ever since I picked it up a couple years ago, but I have a question about the proper way to do something. There's a way of condensing an if/else conditional that has 2 options (True, False), for simple things. Assume that [icode]playerWins[/icode] is a boolean: [code=python] …

Member Avatar for shadwickman
0
112
Member Avatar for crumpet

Hi, I'm trying to create a "command line" in Python, which makes a user input a certain command and its associated data, without the use of brackets. So the user would input: >>> test 1 2 3 So it would carry out a command: [CODE=python] def test(firstnum,secondnum,thirdnum): return firstnum,secondnum,thirdnum [/CODE] …

Member Avatar for crumpet
0
152
Member Avatar for DisembodiedLoaf

I have two programs I've been working on for my class but I keep getting different errors. First one: Write a boolean function called isTriangle that receives three numbers and returns true or false based on whether or not the numbers are possible lengths of a triangle. If the sum …

Member Avatar for shadwickman
0
180
Member Avatar for jessica2009

[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 …

Member Avatar for vegaseat
0
119
Member Avatar for jessica2009

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 …

Member Avatar for jessica2009
0
100
Member Avatar for harrykokil

how can threading in python help me in my traffic simulation project? can i use it to detect other cars?

Member Avatar for scru
0
65
Member Avatar for lilkid

[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 …

Member Avatar for lilkid
0
127
Member Avatar for loren41

[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 …

Member Avatar for sneekula
0
255
Member Avatar for Darkangelchick

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 …

Member Avatar for woooee
0
639
Member Avatar for mannclay

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...

Member Avatar for mannclay
0
80
Member Avatar for leegeorg07

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 …

Member Avatar for leegeorg07
0
303
Member Avatar for andy121

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 …

Member Avatar for alc6379
0
148
Member Avatar for schuerm

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 …

Member Avatar for jworld2
0
384
Member Avatar for daniwebnewbie

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 …

Member Avatar for paddy3118
0
257
Member Avatar for jascase901

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 …

Member Avatar for lllllIllIlllI
0
155
Member Avatar for docaholic

[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?

Member Avatar for Dhaneshnm
0
281
Member Avatar for FengG

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 = …

Member Avatar for FengG
0
6K
Member Avatar for shailev

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 …

Member Avatar for Gribouillis
0
56
Member Avatar for daniwebnewbie

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 …

Member Avatar for daniwebnewbie
0
150
Member Avatar for crumpet

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 …

Member Avatar for daniwebnewbie
0
137
Member Avatar for devstudio.2007

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. …

Member Avatar for sneekula
0
103
Member Avatar for tehbrozor

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 …

Member Avatar for tehbrozor
0
131
Member Avatar for dilipkk

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 …

Member Avatar for dilipkk
0
4K
Member Avatar for ls129

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 …

Member Avatar for Gribouillis
0
156

The End.