15,406 Topics

Member Avatar for
Member Avatar for EAnder

I am trying to add user input using the raw_input function to string url_orig. I am attempting to replace the spaces with +'s to make a 'google search'. the replace function works fine in IDE but not when I excecute the program. Any help will be appreciated [code]url_orig = 'http://www.google.com/search?hl=en&q=' …

Member Avatar for woooee
0
98
Member Avatar for gtrashing

Hi, I'm tring to write a script that as to be executed by root on linux... This script execute other bash script normally like root, the problem was that I have to log what my script do. I choose the logging library... Perhaps I have to write the log in …

0
41
Member Avatar for JA5ONS

Okay, I appreciate everyone's help! i am trying to work out how to find a duration type thing.. i have created this as an example of what i am trying to do. [CODE] ### gaining inputs start= raw_input("What time did the tv show start: (Format = 14, 12) ") finish= …

Member Avatar for JA5ONS
0
119
Member Avatar for JA5ONS

just wondering if there is anything in python to give the date automaticly, just like excel has =today() cheers.

Member Avatar for lllllIllIlllI
0
151
Member Avatar for Potty391

Hi everyone, I just started working with Python and programming in general (i chose it as a school subject for this year) and i received a task(scroll a bit more down).. since im a total newbie with Python in general.. i was hoping someone could please explain this task in …

Member Avatar for woooee
0
100
Member Avatar for JA5ONS

well, after the help i have had already tonight, i thought i might come ask another issue i am having with saving the file with the .txt extention. i can save each file as the car model first name for each entry, however it wont put the .txt extention on …

Member Avatar for Ene Uran
0
46
Member Avatar for dinilkarun

listText=["Car","Bike"] for intkLoopIndex in range(0,2) f.write(str(listText[intkLoopIndex])+ '\n') i am using the above code to write a string onto a document. How can i display the text in [B]bold [/B]in the document? Can i set the font property when i write?

Member Avatar for woooee
0
105
Member Avatar for lllllIllIlllI

Hi I was wondering if there was any way i could use a module or some code to enable and disable my wireless network becuase i often have the problem that it wont connect and enabling and disabling it a number of times nearly always fixes it and i was …

0
50
Member Avatar for Mackjan

This function arranges a list of number. If we try z= [4, 4, 2 ] the result will be after some steps 4,3,2,1 but my list is z = [ 1, 1] and I want if a cycle of number coming up again and again the main program will discover …

Member Avatar for Mackjan
0
84
Member Avatar for FreezeBlink

Iterating over a list, possibly deleting elements. It's the bane of my existence. Suppose, for instance, we have a list of numbers, and want to iterate over it and delete each and every odd one. Sounds simple, right? Sorta. It's trivial, but the code you end up with is pretty …

Member Avatar for jrcagle
0
118
Member Avatar for sarabhjeet

Hi All, first of all thanks to all for helping me out till now, whenever i got stucked somewhere that time u all helped me out.I need some more help of u all.I am using python 2.5 along with wxpython,and i need to increase the visibility of the dialogs and …

Member Avatar for sarabhjeet
0
89
Member Avatar for msaenz

Greetings, I am trying to do a reconnect type of thing for when sqlserver disconnects me i check and reconnect to execute a query. here is some code that i wrote, I really don't know what to use since there is not isconnected method or reconnect method in pymssql. Any …

Member Avatar for jrcagle
0
2K
Member Avatar for bf2loser

can someone show me some code to convert rankine temperature to kelvin? rankine is in the same scale as fahrenheit, but it starts at absolute zero. so 0R = -459.67F, heres is what I have convert to kelvin [code=python] def __init__(self, value=0): Fah=value-459.69 Cel=(Fah-32)*5/9.0 value=Cel-273.15 Temperature.__init__(self, value) [/code] convert back …

Member Avatar for jrcagle
0
1K
Member Avatar for Potty391

Hello everyone, I'm a total newbie with most of the things on this forum, but im willing to learn. Im already doing a course (sort of) in Python at school. Please put up with all my basic questions, By the way, Im from South Africa

Member Avatar for zandiago
0
51
Member Avatar for mruane

I am not sure how to word this question. If I am defining function() to be a user input prompt, does the [code] name_of_prompt = raw_input("") [/code] name of prompt equal the name of fucntion or could it be prompt_funct1? If so, when using if...elif statements to call on other …

Member Avatar for slate
0
299
Member Avatar for turnerca902

Hi all, I have a little project that I think would be possible to accomplish using python. I'm a beginner at this sort of thing, so I am posting the basic information in the hopes that someone out there could help me get started or point me in the right …

Member Avatar for woooee
0
154
Member Avatar for clouddragon

hello, I have to write a program that draws a chart from dictionary entries. I am able to make a draw a chart however it is unsorted. How can i get it sorted. Please help asap. THANKS in advance. [CODE]from random import shuffle from graphics import * def main(n): win …

Member Avatar for vegaseat
0
168
Member Avatar for joshuabraham

os version =windows xp hi guys i'm having problems using pygame the following code just does not seem to work. Code: ( text ) 1. clock=pygame.time.Clock() 2. while True: 3. sound1.play() 4. clock.tick(60) 5. pKeys = pygame.key.get_pressed() 6. Eves=pygame.event.get() 7. villian.face() 8. villian.hert() 9. if Eves[KEYDOWN] and pKeys[K_UP]: 10. hero.moveup() …

Member Avatar for joshuabraham
0
177
Member Avatar for ccandillo

I am still reading the learing python o'reilly book and not sure the best way to approch my problem. Given c:\dir1\dir2\dir3. I want to zip all files in dir3 if those files are older than 30 days using 1 zip file (ie. dir_3_files.zip). If all files in dir3 are older …

Member Avatar for woooee
0
1K
Member Avatar for jimbox123

hey everybody I'm taking a computer class right now and one of the projects I need to do is create a very simple pizza-ordering menu. At this pizzeria, there is only one kind of pizza you can order: regular (cheese) with no toppings. Your choices are what size of pizza, …

Member Avatar for vegaseat
0
1K
Member Avatar for dinilkarun
Member Avatar for Ene Uran
0
115
Member Avatar for s_jmp

hi pythoners, i have problem in understanding bind method of socket module i have read many articles and even pythons help and docs but i couldnt feel what it really is so anyone can help me please?

Member Avatar for a1eio
0
66
Member Avatar for gReaen

Hello, I wanted to know if Python can be bundled with any C++ project so that it can be installed when the executable of the project is run. I use Python 2.4 and PyXML-0.8.4 on Windows XP SP2.

Member Avatar for Ene Uran
0
54
Member Avatar for FreezeBlink

Just noticed an odd little problem. Instead of explaining it, take a look at this IDLE run: [code]>>> ================================ RESTART ================================ >>> class test: eggs = True >>> var1 = test() >>> var2 = "text" >>> type(var2) <type 'str'> >>> type(var2) == str True >>> type(var1) <type 'instance'> >>> type(var1) …

Member Avatar for Ene Uran
0
264
Member Avatar for i_saw_some

Hey, Does anyone know how to pickle classes that have classes within them? I get back the top level attributes, but not the attributes under them. For instance: [code] import pickle class authorObj(): class authors(): pass q = authorObj() q.authors.name = 'somebody' output = open('test.pkl', 'wb') pickle.dump(q, output) output.close() [/code] …

Member Avatar for Ene Uran
0
116
Member Avatar for budstar

Can someone please tell me what I am doing wrong with this loop. I want to end the loop when either one of the tanks armour reaches zero. Also if I wanted to add more tanks how can I have the loop end? Thanks import random class Tank (object): def …

Member Avatar for bumsfeld
0
101
Member Avatar for Azurea

Hey, this time I'm back with a threading error! I need to write code that gets the address of a message sender while at the same time letting the user know that the pygame didn't freeze, so I started a thread to keep control of the screen while searching for …

Member Avatar for Azurea
0
110
Member Avatar for stabler_rocks

Okay i'm probably majorly over thinking this but i need to create a counter that counts how many weeks a certain value gets exceeded, except i honestly don't know how to do it. I thought of find the end max value and taking it away from the first max value …

Member Avatar for woooee
0
98
Member Avatar for lllllIllIlllI

Hi I have been working on a blackjack program and i have hit a brick wall as one of my Global assignments isn't working for some reason [code] import random class Cards(object): def __init__(self): global cards global player global comp global comp_tot global playert cards = {2:4,3:4,4:4,5:4,6:4,7:4,8:4,9:4,10:16,'ace':4} player = [] …

Member Avatar for lllllIllIlllI
0
181
Member Avatar for ABSOR

I just downloaded and installed ActivePython on my windows PC (XP). I can bring up the editor and can write very beginner lines of code in the editor and save and run the program. However, when I create any function the interpreter says there is an error, no matter how …

Member Avatar for ABSOR
0
94
Member Avatar for dangermini

Hey I'm just trying to develp some code for some coursework i've got to do. I am wondering is it easier for me to write the code for what I want to do and then integrate the PyQt GUI after I've written the code, or is it best practice to …

Member Avatar for dangermini
0
144
Member Avatar for saywell

Can anyone help me with a python script I'm writing to change a password in a batch file. I need to replace the old password with the new one. I can do this by getting the old password from the user by raw.input, but I'd really like to just replace …

Member Avatar for saywell
0
81
Member Avatar for Mackjan

I have a function when I use it outside the class as a function it works perfectly but when I want to use I as a method in a class I get a TypeError massage : [COLOR="Red"]Traceback (most recent call last): File "H:\python\prototyp_01.py", line 122, in <module> manupacians.koor(z) File "H:\python\prototyp_01.py", …

Member Avatar for Mackjan
0
149
Member Avatar for ivy47469

I am working on the odd number magic square problems. I start the first number in the last row and center column. It worked on the 3x3 square, but not on any other odd numbers. Can anybody check my code? [code] def magic(n): if n > 2 and n % …

Member Avatar for BearofNH
0
141
Member Avatar for donnerCobra

Hi, I wanted to ask if you can help me with my example-sourecode to Wrap an C++ Object. I know Boost, but I don't want to use it cause of several points. Does someone knows an example code for an Object Wrapper? Thanks A LOT!!! [code=c] #include <Python/Python.h> #include <string.h> …

0
65
Member Avatar for sreelatha

Hi, I have a requirement that i have two files, one is input file and another is log file(both will contain the same data mostly). I need to compare these two files and if any difference found then those lines should be write to another file(3rd file). I done googling, …

Member Avatar for sreelatha
0
3K
Member Avatar for preyan

I have pygame v 1.8.0 installed but it is without the font and video module support how do i have to enable it or from where do i have to get it

Member Avatar for preyan
0
83
Member Avatar for tondeuse34

Hey guys, recently i started with socket programming in python and still doing it. And i decided to do a project, its a text based GUI with different options that are related to Networks, but ive had trouble with it looping back to the menu which the input is represented …

Member Avatar for jrcagle
0
119
Member Avatar for ivy47469

I am writing a Crap Game. The first part turn out fine but I have problem with this requirement [I][U]"Your program must keep track of and report the number of games won by the user and the number of games won by the computer ("house"). The score should be 0-0 …

Member Avatar for jrcagle
0
102
Member Avatar for budstar

Sorry I just realise that made not sense. I have created a program in python similar to battleships. I have created the class section which were working when I include the direction section in the main and not as a seperate method, However when I move the method into a …

Member Avatar for jrcagle
0
140
Member Avatar for dangermini

Hi, i am currently trying to learn how to program in python and i have been doing ok until now! I am confused about classes objects and methods, i understand most of how they work. In a question task I am asked to create some code for a die (singular …

Member Avatar for dangermini
0
85
Member Avatar for Kabooom

Hey all, had another question that came up in my first Python program. The program is pretty much just a GUI for an application launcher. My current version has rollover buttons and successfully launches the applications, but is bloated and needs some revision so I'll post the first version with …

Member Avatar for Kabooom
0
300
Member Avatar for saywell

Just Joined! Dabbler in computers. Mainly windows but am attempting to upgrade to Ubuntu. Dabbling with batch files and have just started toying with python. Other main interest is photography. Live in UK and work as in diagnostic imaging. Nice to 'meet' you all. William

Member Avatar for jasimp
0
31
Member Avatar for biggz

i need to build a recursive function which calculates the average of specific numbers entered ... so its fine till now but ... it says the number of entries is determined by the user's interest .. so i got some ideas i kinda stopped here i made a function which …

Member Avatar for bumsfeld
0
99
Member Avatar for heshan

Hi, I am having a string like below. What I need to do is to process the string in such a way that I could get the output in a format like below.The problem I am facing here is that some elements have commas(,) within itself , so it is …

Member Avatar for bumsfeld
0
142
Member Avatar for lllllIllIlllI

HI I was having a look into classes and i noticed i saw a lot of things like [code] class fruitcake(object): pass [/code] my question is what is the point of the "object" being in the class arguments as it is a Built In Function and i couldn't work out …

Member Avatar for bvdet
0
106
Member Avatar for supra87

Hey guys, I recently started an online Python course as I had some interest in it, this is the second assignment I have received (first one was a purely text based Python solver), and I have become really stuck as I haven't found much on GUI. Basically its about class …

Member Avatar for left_shoe
0
353
Member Avatar for lllllIllIlllI

Hi I have the source of a webpage that tells the weather and i want to extract the data and my only hurdle left to jump is to remove all the formatting HTML marks inside and including the <> bracket. I have the web page source stored as a string …

Member Avatar for bumsfeld
0
106
Member Avatar for uili

Hello , Down here we have my code and the error in the compilation, and i dont know how to resolve this can anyone help me. Just a introduction: This python script is used to save datas from a form in sql_data base. # Available parameters: # fields = HTTP …

0
41
Member Avatar for ymf

Hi all, I tried to write in a fibonacci sequence using python: [ICODE] unum = int(raw_input('Enter Limit Number to run Fibonacci sequence: ')) numlist = [1,1] for i in range(unum): fib2 = numlist[i+1] + numlist[i] numlist.append(fib2) print "Here's Fibonacci!" for w in numlist: print w, [/ICODE] This works fine. But …

Member Avatar for ymf
0
115

The End.