15,181 Topics
| |
I'm trying to make a simple program that prompts for a password and then continues to a different section of the program, else loops back to the original prompt for the password. I can't find a way to do this other than to use external things - such as text … | |
Dear all, I built 2 script to manage 2 different frames (which I will then convert to exe with py2exe). Frame 1 (GG1) is like this [CODE]import wx # begin wxGlade: extracode # end wxGlade class MyFrame(wx.Frame): functions here ... if __name__ == "__main__": app = wx.PySimpleApp(0) wx.InitAllImageHandlers() GG1 = … | |
How do I get datalist to string? >>> days = 24/6 >>> print days 4 >>> hours = 45/7 >>> print hours 6 >>> datalist = [] >>> datalist.append(days) >>> datalist.append(" days ") >>> print datalist [4, ' days '] >>> datalist_str = "".join(datalist) Traceback (most recent call last): File … | |
Hello! Here is the code, pls have a look fist: [CODE]class Cstudent(): def __init__(self, name): self.name = name self.subjets = [] self.mark = [] def add_subject(self, subject): self.subjets.append(subject) def add_mark_student(self, subject, mark): subject.add_mark(mark) def __str__(self): return 'I am object of student: %s'% \ (self.name) def print_list_of_subjects(self): lst = [] for … | |
[CODE] import os; def callAS(cmd): os.system(cmd); def selectFile(): callAS("""osascript -e 'tell application "Finder" to return choose file "Select the file:"'""") def fixPath(raw): arr = raw.split(' '); return(str(arr[1])); thePath = selectFile() thePath = fixPath(thePath); print(thePath); [/CODE] When the above code is run in IDLE, it just gives an error. But, when … | |
The code shows a fast prime number generator using a sieve algorithm. It looks at only odd numbers. Technically 1 and 2 are prime numbers too, since they are only divisible by unity and themselves, exceptions are made for 1 and 2. Zero and negative numbers return an empty list. … | |
Hi All . I am trying to make a Frame to which we add dynamically Add panels. Also I want to remove panel dynamically . The dynamic Addition is working perfect. Please see the code below: # panels.py #self.Fit() causes the whole frame to shrink.So we are using self.Layout instead … | |
I have written this short code [CODE] import os import os.path import string import shutil import difflib Path = 'C:/RESULT/BATCH/SimpleInputParser/' SecPoint = [] FullList = [] newFile = [] for fileName in os.listdir(Path): if fileName.endswith(".inp"): f=open(Path + fileName, 'r') files = f.readlines() f.close() fp_clean = open(Path + "tempClean.inp", "w") fp_newFile … | |
Hi there, i'm learning python by reading a book and i am stuck in one of its examples: i created succesfully a file with a basic script in it (i run it with the GUI) and it works fine, the file is named script1.py and i saved it in [B]C:\Users\username\doocuments\varios … | |
hi, is there any way to restart Tkinter program while running. I would like to put some button that will when pressed put everything as it was in moment I started program thx | |
Okay, Im not sure how to put this. So here is my first try, and if it aint clear enough I'll try to explain better. I have made a few scripts that work perfectly fine, but now my client prefers it to come with a GUI. My script needs 2 … | |
Hello, I'm manipulating large quantities of HTML files (about 2000). I'm new with Python, and would appreciate any help. For example, I want to delete the lines that contain "embed_music" in all the files, or change all instances of the word "Paragraph" to "Absatz". This is my pseudo-code: [CODE] open … | |
I've used Pythoncard to create my gui. Here it is in heavily condensed form: [CODE] import os import sys import os.path import Tkinter import wx import subprocess import subprocess as sp from subprocess import Popen from tkFileDialog import askopenfilenames from tkFileDialog import askdirectory import tkMessageBox from Tkinter import * from … | |
I'm just starting out with Python and like the way pythoncard handles the graphics for me. However I cannot work out how to get the data from the radio buttons. The radiobutton.html page is missing from the docs! I've exhausted google (its 4.30am!) and have had no luck. Please somebody … | |
Hi All, If i copy/paste line for line the below code into IDLE (v2.5 or v2.6) it works perfectly and sends me the email message. [CODE]import smtplib fromadd = "arcazy@foo.com" toadd = "meufelt@wfoo.com" msg = "Insert message body here" server = smtplib.SMTP('exchange01.foo.com') server.sendmail(fromadd, toadd, msg) server.quit()[/CODE] However, If I try … | |
I cannot understand why this doesn't do as I expect... [CODE] if (os.path.exists(ofile)): os.unlink(ofile) print "it existed, but I've deleted it!" print "It didn't exist so I'm creating it" ---Here we have a subprocess command--- [/CODE] The print statements print as you'd expect but the command only runs if "ofile" … | |
pleas help... is it possible that a wxpython program can become a web page?? | |
Hi, I'm trying to run code that asks a yes or no question. If a yes or no isn't entered, then the question will continue to re-ask say every 3 seconds until a yes or no is entered. Here's the basics of it: [code] while True: response = raw_input(" Are … | |
Hello, I am learning classes, and find it a bit difficult... :-( Mine intention is to add subject(predmet) and mark to the objet janko but if I search in self.predmety, I get False, means that it can't recognise predmet in self.predmety list State of self.predmety is as folloving: [<__main__.Cpredmet instance … | |
#Guess my number #The computer picks a random number between 1 and 100 #the player tries to guess it an dhte computer lets #the player know if the guess is too hight, too low #or right on the money import random print "\tWelcome to 'Guess My Number'!" print "\nI'm thinking … | |
Hello, could someone explain recursion to me? It would be much appreciated! | |
I'm sort of on the way, but my current method will require me to save the converted array first, then display it. What are a few ways I could use wxPython, numpy, and scipy to efficiently display the changes realtime, without saving every damned time? I don't need actual code, … | |
| if i have a dictionary like this {ric:24, ric1:46, ric2:23, mike:1, mike1:47} and have a list that has 'ric' and 'mike' how do i get all the values whose key contains 'ric' or 'mike'? i want to ignore the last numbers |
a=1 b=2 x="ab" How do I "print x[0]" and get a result of "1" (int), instead of letter "a"? (make the string use global variable) Please help me, thanks. | |
I'm creating a program that carrys out certain things dependent on the user input. One function is to read text from a text file, another is to add text to the same text file. I'm unsure about how to add an exception handler to make sure the text input is … | |
I got this code, when i compile it it shows this error: Traceback (most recent call last): File "C:\Users\User\Desktop\Server2.py", line 13, in <module> UDPSock.bind(addr) File "C:\Python27\lib\socket.py", line 224, in meth return getattr(self._sock,name)(*args) error: [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted If you can … | |
Hello all friends , i'm biginner in scripting , i just wanted to send i folder to a distant machine ising scp , without writing the password of the distant machine in terminal .For that , i found a script which is : [CODE]#!/usr/bin/expect -f # effectue le transfert par … | |
hi all, i am new to python programming.i need to develop one client server program. here once the client and the server start at the first time, the client automatically send one message to the server . this is a random message, here after the client is waiting for a … | |
I would like to use the front end to send info to a program built in python 2.7/3.2(not sure which yet but most likely 2.7). That program would then send data back over to the front end and create new buttons (the number of buttons will be arbitrary). I have … | |
Hi all, I just started learning Python and Beautiful Soup. I am developing a script to look for particular text "Running" in the HTML. If that text "Running" exits, I would like to print out the keyword "QSAJK". Please see the attached image to visualize. If there is one or … |
The End.