15,180 Topics
| |
I keep hearing that the eval() function is unsafe. It is a nice function, because you can use it like print eval("2.5*49.7/(23+3.14)") and it will solve the math. Is there any way to protect against some nasty minded person to enter a "os.system(command)" where the command will erase a file … | |
Hello people of Python community, I'm back with (so far) strong will to learn Python, just like you. I remember once, Narue told me that good way to learn different prog. languages is to concetrate on algorithms and data structures and their implementation in language of choice. That way, she … | |
I have been looking over Vegaseat's Word Count program. I have two thoughts about what I want to configure it to do, but I'm not sure how to go about it. Idea 1; This is most important. I want users to be able to put a text file in the … | |
Hi! Thanks for your help in advance..... Heres my case I have a dictionary "d" with keys as string and a dictionary as integer "1" as keys to a list [1,2,3] [code] d{"test.tif": {1: [1,2,3]}} [/code] Now when I try looping through it........it gives me an error [code] for i … | |
simple problem....but I have no clue why its not working..... [code] if (w[0] > m[1]): temp = ((w[0]-m[1])/w[0])*100 print temp [/code] For some reason temp is always 0.........I want a double percentage difference between the two values.... Please guys..help me out here......after 500 lines of code ...I am stuck here......my … | |
Hi, I've encountered a problem iwhile writing a find and replace prg in python. this is my code: [CODE]import re f = file('testfile') while True: line = f.readline() if len(line) == 0: break print line p = re.compile(line) m = p.match('METASERV_HOME') print m f.close()[/CODE] as per the logic : if … | |
Hi everyone, I am new to python and programming in general and I could use some help on converting an integer to a decimal (e.g. 80% to .8). Here is what I have so far but as I'm sure you can tell, it doesn't work: [CODE]elif menu_choice == 2: print … | |
Hi Python Experts [B]I need to convert a code written on JAVA/JSP (Java Tags are also there inside JSP) to PYTHON. [/B] I have OK kind of knowledge in PYTHON, but dont have a muck knowledge in JAVA/JSP. Any idea how to approach? I am having tough time to achieve … | |
I am using automation desk to run python scripts. This in tern executes scripts using v2.2 interpreter every time i m trying to use raw_input("Enter name ") it fires EOF Error. If i run it in interpreter separately it works fine.Its really basic functionality. FYI: Automation desk dont support script … | |
Hi Java Veterans [B]I need to convert a code written on JAVA/JSP (Java Tags are also there inside JSP) to PYTHON. [/B] I have OK kind of knowledge in PYTHON, but dont have a muck knowledge in JAVA/JSP. Any idea how to approach? I am having tough time to achieve … | |
i don't understand the use of the os.popen function, i've used it to read things, for example: [CODE] >>> a = os.popen("netstat") >>> for line in a.readlines(): print line Active Connections >>> [/CODE] i understand that, but there is also a buffersize and a write ability, but i've played about … | |
This small program is neat: [CODE]import calendar calendar.prmonth(2006, 3) """ March 2006 Mo Tu We Th Fr Sa Su 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 … | |
Does anyone know about LISP Programming I am trying to make this program where I have 3 types of cars, which are ford bmw merc ford has focus and fiesta BMW has 1series and 2series and the merc has SK100 and SK200 well basically i am trying to put them … | |
Hi!I have a problem and i think you can help me!(Sorry my english.I learn just one year) Thats part of my program... [code] okno=Tk() text=Text() text.pack() def find(): print "I need help here" menubar = Menu(okno) editmenu = Menu(menubar, tearoff=0,bd=4) editmenu.add_command(label="Find", command=find) menubar.add_cascade(label="Edit", menu=editmenu) okno.config(menu=menubar) [/code] i need add to … | |
I have the following code, for example: [CODE]price = 50.00 tax = price * 0.08 print "Tax = $",tax # Tax = $ 4.0[/CODE] As you can see there is a space between $ and 4.0. Is there a way to avoid this? I haven't done much Python coding. | |
hi, i am very new in python. can anyone tell me that how to create dynamic dropdown box in python scripting.(triple dropdown box) | |
I need help please to write this program. Numerologists claim to be able to determine a person's character traits based on the "numeric value" of a name. The value of a name is determined by summing up the vaules of the letters of the name where 'a' is 1, 'b' … | |
For the Tkinter Text widget, is there a way to assign the selected text to a new tag?(other than 'sel',which changes) | |
:?: [CODE]#The number of lines, and the number of words. import string def main(): data = raw_input("Enter the path and name of your ") infile = file(data, 'r') data_file = infile.read() number_of_characters = len(data_file) print "The number of characters in your text is", number_of_characters list_of_words = string.split(data_file) number_of_words = len(list_of_words) … | |
I need to design a GUI based on PyAUI. Do anybody have sample codes or tutorials that show the working of PyAUI. | |
[CODE]import sys def main(): usage = 'Usage: %s [options] <file name>\n' % sys.argv[0] options = 'Options:\n' options = options + ' -c, --chars print the character counts\n' options = options + ' -l, --lines print the newline counts\n' options = options + ' -w, --words print the word counts\n' usage … | |
import sys :o def main(): usage = 'Usage: %s [options] <file name>\n' % sys.argv[0] options = 'Options:\n' options = options + ' -c, --chars print the character counts\n' options = options + ' -l, --lines print the newline counts\n' options = options + ' -w, --words print the word counts\n' … | |
Word Count. A Common Utility On Unix/linux Systems Is A Small Program Called "wc." This Program Analyzes A File To Determine The Number Of Lines, Words, And Characters Contained Therein. Write A Version Of Wc. The Program Should Accept A File Name As Input And Than Print Three Numbers Showing … | |
AM I DOING THIS RIGHT, PLEASE HELP ME, SO ME MORE EXAMPLES ON HOW TO RIGHT IT :o C:\home\COP1000\a\3>python wc.py futval.py test.txt wc.py 22 103 699 futval.py 2 4 22 test.txt 52 223 1683 wc.py 76 330 2404 total | |
Hello Everyone... i am right now facing a simple at the same time a difficult problem....is there any way by which we can change the default green colour in gauge to another colour in wxPython.... I tried doing it in many methods but all failed....can anyone suggest any solution... | |
Hi, I am thinking about using the Python Imaging Library to display the life cycle of a hair follicle gene. This life cycle is divided into four main stages: 1. Anagen 2. Catagen 3. Telogen 4. Exogen Gene name and corresponding life cycle stage will be stored in a csv … | |
how do i move to next record after i click a button called 'Next' and how do i move to previous record after i click 'Previous' in MySQLdb. does method exists to do this? please help me........... [I]import MySQLdb from Tkinter import * db=MySQLdb.connect(host='127.0.01',user='',passwd='',db='Trimtabs') print 'mysql got connected.....' cursor=db.cursor() root=Tkinter.Tk() … | |
If I want to convert one type in another, I can use casts: [code]s = str(12.5) i = int(s) f = float(s)[/code] However, there doesn't seem to be a function cast, or even a statement cast. So how can I turn this string into a statement? [code]s = """for i … | |
hi ppl, i am kartik saxena , 2nd yr comp sc at Delhi College of Engineering Can anybody tell me about good python projects?? i hav recently completed a the backend server of our multiplayer quiz event known as techniche which will be released online soon . please visit: [url]www.dcetech.com[/url] … | |
how to open a new window only when i click menuitem. for example, check out this following code, in which Toplevel window comes up as soon as u run the code. i dont want that. i want the new window to open only when click 'one' in the menu bar. … |
The End.