15,406 Topics

Member Avatar for
Member Avatar for Icklebitt

Hi, I have recently started trying to teach myself python, I've watched a few video tutorials and am reading "Learning Python". I have been making an Mp3 player and have hit a point that I cant work my way past so was hoping some kind person here could help me …

Member Avatar for Icklebitt
0
2K
Member Avatar for denniskhor

My question as below: 1. How to save result text to HTML in Python? 2. If i want continue append more result text in the same HTML file, how?

Member Avatar for shadwickman
0
4K
Member Avatar for hughesadam_87

Hey guys, Say I had the following list: [1, 2, 2, 2, 3, 4,4] Let's assume that the list will always be integers. Does python have a built in feature which would take a sorted list, and then return the frequency that each element occurred. For example: 1 -> 1 …

Member Avatar for jlm699
0
157
Member Avatar for TerabyteST

Hi, I got a staticline I want to resize automatically following the sizer, but it never resizes, and I have to resize it automatically. What's the problem?

Member Avatar for jlm699
0
55
Member Avatar for sravan953

Hey guys... I was recently working on a program, which opens a music file using Windows Media Player...so I tried: [CODE]subprocess.call("C:\Program Files\Windows Media Player\mplayer2.exe",loc) # Where 'loc' is the location of the file[/CODE] But then I got to know that it won't work and that I have to use: [CODE] …

Member Avatar for zachabesh
0
111
Member Avatar for sab786

hi all... ok so i have a file and what i wish to do is read all the lines usilng readline() then for everyline i need to read and match lines and form groups. how i need to do this is that say for example... line[0] match move to line[3] …

Member Avatar for gnujohn
0
89
Member Avatar for pluring

Hi! I'm trying to search a html site for a spefic word and print the result thats x rows after that word. If the html page looks like: "Hello welcome to daniweb" I want to search for welcome and look for what the next word is ("to" should be the …

Member Avatar for pluring
0
106
Member Avatar for pythonbegginer

I have a lot of directories that start with "td." for example i have: td.10000 td.11102 td.00384 td.35454 td.32356 Is there a way in which i can tell python to remove all directories that start with "td." ? If so, how?

Member Avatar for pythonbegginer
0
188
Member Avatar for poeticinsanity

So I feel rather foolish for this, but I haven't used command line often. I'm using sys.argv to gather arguments from the command line. I'm saving one in particular to a variable called test. It is suppose to be a boolean; however, passing in True or False still renders if(test): …

Member Avatar for poeticinsanity
0
6K
Member Avatar for arinlares

So, I've started writing a text adventure in Python, and already have the first map idea figured out, but I don't know where to start with defining a variable for each room. I know about the simple stuff, such as (represented as it would be in IDLE) [code=python]>>x = 4 …

Member Avatar for bumsfeld
0
103
Member Avatar for Morika

Hi, I'm a newbie to python and I need to extract numbers from a path name. A path name such as: /grups.google.com/grup/cmp.lng.pythn/browse_thread/thread/8_ee63e_[B]17[/B]del_0c12d And I'm trying to get it to take out the 17. I thought I could just do: [ICODE]det file = /grups.google.com/grup/cmp.lng.pythn/browse_thread/thread/8_ee63e_[B]17del[/B]_0c12d index = det_file.find('del') dent = det_file[index[-2]][/ICODE] This …

Member Avatar for Morika
0
143
Member Avatar for sneekula

Does anyone know a good internet site where I can 'park' my Python code? Easy download, upload, and search.

Member Avatar for zachabesh
0
203
Member Avatar for tomtetlaw

I am making a text game, and what I want it to have one console window for showing the game, then another one next to it showing the players stats. Is this possible ??

Member Avatar for shadwickman
0
133
Member Avatar for Clueless86

Ok, I made a very simple function to keep track of variable Gold...Ok thats easy, everything works fine, except I made the variable = 200 and when the function performs it adds like it is told to do. But I want it to evolve as I add to it, and …

Member Avatar for shadwickman
0
315
Member Avatar for thenameisprayag

Hi, I am working out a program which involves emailing through a SMTP host I dont have control over... I can mail through PHP code but cant do so through python, because I get the following error Traceback (most recent call last): File "Teshting.py", line 7, in <module> smtp.sendmail('Sender','thenameizprayag@gmail.com','Test') File …

Member Avatar for jlm699
0
838
Member Avatar for pongetti

Hello, I have a structure like this: [code] package/ __init__.py subpackage1/ __init__.py baseclass.py subpackageA/ __init__.py ClassA.py subpackageB/ __init__.py ClassB.py [/code] in package/__init__.py and package/subpackage1/__init__.py I am importing the subpackages so that in my app I can just call import package instead of having to import each subpackage individually Here is …

Member Avatar for jlm699
0
301
Member Avatar for sriramaam

hi, I am trying to do some aombination study. I have saw some codes on permutations and combinations. But for all those programs input is a single list. I am trying to make combination from 4 lists. I have input 4 lists. Now I want to generate several combination lists. …

Member Avatar for sriramaam
0
136
Member Avatar for sanju.d1231

Hi, I have written a small code to connect to solaris machine from cygwin...but this code is giving some error. please see the code below..i am expect some solution of this error.. Thanks in advance import os, pexpect, time FirstTime_Ssh='Are you sure you want to continue connecting (yes/no)?' def ConnectUnix(): …

Member Avatar for jlm699
0
203
Member Avatar for Zetlin

Hi everyone I am writing this program that takes a string and search it for words. Those words are taken and they get "<" at the beginning and ">" at the end of the word. then it prints the string with the words and the "<, >" characters. Here is …

Member Avatar for Zetlin
0
261
Member Avatar for flipjoebanana

Hello, I am wondering the best way to go about this in python. Basically what I want is to encrypt a password (using something in python or open source) while masking the password in a wxpython text field(i.e. instead of 'password' it will show '********' on the screen). I realize …

Member Avatar for vegaseat
0
155
Member Avatar for bladelord76

I need some help with a code I'm working on. The code starts off by creating a class for types of cars. Once that's done, I have it construct a list of predetermined vehicles (all made from the aforementioned class), and then I ask for user input, to see if …

Member Avatar for bladelord76
0
179
Member Avatar for tomtetlaw

I want to sort a dictionary, say that it was like this: [code] a_dict = {'2':12354, '1':12355432, '4':35342, '3':858743} [/code] How would I be able to sort it so it's like this: [code] a_dict = {'1':12355432, '2':12354, '3':85874, '4':35342} [/code] Is there any algorithms already built it? Or do i …

Member Avatar for scru
0
110
Member Avatar for MediocreGopher

I have a large-ish project that I'm working on. It involves lots of modules with lots of classes inside them, and everything is coordinated by the main thread. Now, I have a variable in the main thread which I need to be accessible from pretty much everywhere (by which I …

Member Avatar for MediocreGopher
0
84
Member Avatar for liz517

[code=python]from random import randrange import math def main(): print "This program will simulate the probability of rolling " print " a 5 of a knid in one throw." pos = randrange(1,7) dice = [0] *5 value = dice [ : ] for pos in [0,1,2,3,4]: dice[pos] = randrange(1,7) roll = …

Member Avatar for anatashinu
0
179
Member Avatar for sab786

SORRY I THINK I ADDED THIS TO SOMEONE ESLE THREAD B4 Ok so i have a file which i read in ... then i read the data line by line and create lists basically i needed to organsise(sort the data, in numerical order which i can do no problem and …

Member Avatar for woooee
0
85
Member Avatar for pads_irl

Hi everyone, My code is an attempt to teach myself Python. I am looking to create a series of loops using the range function to read data from excel. My problem doesn't lie with reading the data from excel, I know the functions for this, my problem is setting up …

Member Avatar for pads_irl
0
94
Member Avatar for Your_mum

Say I have a variable, 'New', who's value is Raw_input("Enter name: ") How could I take this variable and pass it into a class?

Member Avatar for Your_mum
0
137
Member Avatar for rahul8590

i have recently installed wxpython on python2.5 and wrote the following code [code] import wx app = wx.App() app.MainLoop() [/code] Then i got this error(attached file) , and i have no idea what it talks about. Traceback <most recent call last): File "<stdin>", line 1 , in <module> File "C:\Python25\Lib\site-packages\wx-2.6-msw-ansi\wx\_windows.py",line …

Member Avatar for shadwickman
0
162
Member Avatar for Stefano Mtangoo

I use wamp for PHP issues and would like to Add python support, specifically Django. How do I do that? :)

0
72
Member Avatar for katamole

Hi there, One of the ways one can reverse a string in python is like so: [CODE=PYTHON] Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> mystring = "Hello, World!" >>> mystring[::-1] '!dlroW ,olleH' >>> [/CODE] It is …

Member Avatar for sravan953
0
144
Member Avatar for foosion

I have a tkinter/python program which does something time consuming when I push a button. I'd like to give the user progress reports by updating a label field at each stage of the time consuming process. If have simple loop to the effect [code] for x in y: dosomething(x) self.label1.config(text …

Member Avatar for foosion
0
203
Member Avatar for rajasekhar1242

hi, I am trying to get an image with my python application output. please give me that process.

Member Avatar for zachabesh
0
4K
Member Avatar for hughesadam_87

Hey guys, This questions is more about organization of python modules than the actual construction therein. In my project, we have several scientists performing similar analysis on several different data sets. For each project, the science changes, but the analysis often requires almost identical data handling. For example, one project …

Member Avatar for hughesadam_87
0
128
Member Avatar for Rhijaen

Hi there, this is my first python project. I'm new to python but I have experience in a few other languages. I'm trying to export (to mysql) a list of files and subdirectories from several directories on my hard drive. Basically just so I can have an online database of …

Member Avatar for shadwickman
0
136
Member Avatar for blunsky

Hi, I am trying to log information from my application to memory. I have achieved this using the MemoryHandler Object. However, upon command I need to be able to write this to a log file on the hard drive. I would like the file to be 10 MB, so that …

0
37
Member Avatar for fallopiano

hi all. I know that when you create a class, you put all arguements for that class in a __init__ functions, but what about for actaully making classes? confused? this is what I mean: [CODE=python]class Aclass(Object): insert code here...[/CODE] what is the purpose of 'Object'?

Member Avatar for fallopiano
0
116
Member Avatar for sab786

i have the following snip of data from i file i read in: li=[[4, 27, 6, 22, 0.81186094, 1.12214581, 2], [1, 9, 22, 28, 0.69887889, 0.989934, 2], [4, 27, 100, 30, 0.74796748, 1.04485376, 2], [6, 27, 22, 31, 0.91040724, 1.26681591, 2], [4, 1, 30, 45, 0.485223, 0.77061901, 2], [8, 27, …

Member Avatar for sab786
0
129
Member Avatar for sab786

can anyone help please? i have a snip of my file below can the the numbers be sorted as in excel? 27 4 220 16 0.76151102 1.06059456 27 4 220 17 0.61465055 0.90107796 27 4 221 22 0.81186094 1.12214581 27 4 223 28 0.69887889 0.98993400 27 4 225 30 0.74796748 …

Member Avatar for bumsfeld
0
89
Member Avatar for artemis_f

1. I have an OGLCanvas with shapes on it 2. Double clicking a shape will open up a wx.MiniFrame where the user can do certain things 3. After OK is clicked or the frame is destroyed I would like the "focus" to shift back to the canvas so that without …

Member Avatar for artemis_f
0
208
Member Avatar for Darkangelchick

Hi im writing a program that returns whether an inputted number is prime or not, but Im kind of stuck... [CODE]import math def listfactors(n): # defining the function l = [] for i in range (1, int(math.sqrt(n))+1): if float(n)/float(i) == int(float(n)/float(i)): l.append(i) l.append(n/i) return l primeNum = int(raw_input("Enter number here:")) …

Member Avatar for Progressivism
0
145
Member Avatar for SoulMazer

Hi, I am writing a script that aims to help a person keep a list of characters while reading a book. In doing this, I am writing to a file and checking it constantly, except I ran into a problem. Say I executed a code block such as the following: …

Member Avatar for SoulMazer
0
1K
Member Avatar for Stefano Mtangoo

I have two classes, one inheriting wx.Frame and othe is wx.Dialog. I use the dialog to collect some info and I call its object in the wx.Frame class. The problem is, the dialog should return the value of its TextCtrl values and I have no Idea how to do it …

Member Avatar for Stefano Mtangoo
0
69
Member Avatar for princessotes

Hi, I'm trying to loop through vaules less than 1 eg say from 0.1-0.9. I tried the code below and I get the error "ValueError: xrange() arg 3 must not be zero". My question is, is it possible to loop through decimal values. [code] for x in xrange(0.1,0.9,0.1): print x …

Member Avatar for vegaseat
0
139
Member Avatar for Arrorn

How do I run a .py file from another python file.... I want a program depending upon the option you choose to run a different python program... Ho do i do this... I have tried: [CODE=python] import os if os.path.isfile('file.py'): exec(open('file.py').read) [/CODE] and it requires everything to be global.... only …

Member Avatar for Arrorn
0
109
Member Avatar for flipjoebanana

I can't get the menu or status bar to show up when executing the following program: [code=python] import wx ID_ABOUT=101 ID_EXIT=110 class MainWindow(wx.Frame): def __init__(self, parent,id,title): wx.Frame.__init__(self,parent,wx.ID_ANY,title,size=(200,100)) self.control = wx.TextCtrl(self, 1, style=wx.TE_MULTILINE) self.CreateStatusBar() #A Statusbar in the bottom of the window #Setting up the menu. filemenu = wx.Menu() filemenu.Append(ID_ABOUT,"&About"," Information …

Member Avatar for Stefano Mtangoo
0
153
Member Avatar for sravan953

Hey guys, I wanted to make a program which keeps asking you questions, and continues on and on based on your answers... So basically, I wanted to know whether the user has typed 'why' in the first input, so I tried: [CODE]s=raw_input("Are you feeling bored?\n") s1=[s] a=0 for x in …

Member Avatar for zachabesh
0
96
Member Avatar for Dan08

I'm doing a program on Windows Vista, and what I'd like to do is a program that has got a main window, and has got another window that control the main one, like Microsoft Access. Can anyone help me out how to do it if possible. Thanks Dan08.

Member Avatar for Stefano Mtangoo
0
109
Member Avatar for Morika

Hi, Again I'm a newbie, going through how to think like a computer scientist online tutorial. I have 2 questions in the next lesson that I can't seem to crack, in relation to sub strings. Here's the questions and my working below: This one I can remove letters but I …

Member Avatar for woooee
0
106
Member Avatar for dstar

Hi! I am writing a small Python script.It's function is to tell user external IP address log it into the file and when next time if the script is executed and IP is changed it must display message Here is the code. I have writed the script it tells users …

Member Avatar for zachabesh
0
137
Member Avatar for wotthe2000

Hi I am wondering how to write a list to an html file from scratch. I am currently writing it to a file using: [icode] def wpubooks(self): for i in booklist: s=str(booklist) f=open('/booklist', 'a') f.write(i + '\n') [/icode] Is there a way I can change that code so that it …

Member Avatar for zachabesh
0
142

The End.