15,180 Topics

Member Avatar for
Member Avatar for Ene Uran

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 …

Member Avatar for Ene Uran
0
101
Member Avatar for Micko

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 …

Member Avatar for Ene Uran
0
539
Member Avatar for JoshBebbington

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 …

Member Avatar for a1eio
0
125
Member Avatar for shafter111

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 …

Member Avatar for shafter111
0
144
Member Avatar for shafter111

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 …

Member Avatar for shafter111
0
106
Member Avatar for harini_b

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 …

Member Avatar for pythonguy
0
105
Member Avatar for magnumbi

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 …

Member Avatar for magnumbi
0
266
Member Avatar for csaha

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 …

Member Avatar for G-Do
0
1K
Member Avatar for pythonguy

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 …

Member Avatar for pythonguy
0
180
Member Avatar for csaha

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 …

Member Avatar for freesoft_2000
0
105
Member Avatar for a1eio

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 …

Member Avatar for vegaseat
0
3K
Member Avatar for bumsfeld

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 …

Member Avatar for vegaseat
0
914
Member Avatar for coolman2006

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 …

Member Avatar for vegaseat
0
209
Member Avatar for Blujacker

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 …

Member Avatar for Blujacker
0
92
Member Avatar for Ene Uran

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.

Member Avatar for vegaseat
0
109
Member Avatar for sharma_vivek82

hi, i am very new in python. can anyone tell me that how to create dynamic dropdown box in python scripting.(triple dropdown box)

Member Avatar for vegaseat
0
789
Member Avatar for butterflyTee

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

Member Avatar for alc6379
0
4K
Member Avatar for JabaPyth

For the Tkinter Text widget, is there a way to assign the selected text to a new tag?(other than 'sel',which changes)

Member Avatar for Ene Uran
0
115
Member Avatar for butterflyTee

:?: [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) …

Member Avatar for butterflyTee
0
90
Member Avatar for dhanu_shiv

I need to design a GUI based on PyAUI. Do anybody have sample codes or tutorials that show the working of PyAUI.

Member Avatar for vegaseat
0
388
Member Avatar for butterflyTee

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

0
69
Member Avatar for butterflyTee

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

0
64
Member Avatar for butterflyTee

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 …

0
90
Member Avatar for butterflyTee

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

Member Avatar for butterflyTee
0
475
Member Avatar for dhanu_shiv

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

Member Avatar for vegaseat
0
91
Member Avatar for juergenkemeter

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 …

Member Avatar for vegaseat
0
302
Member Avatar for katharnakh

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() …

0
71
Member Avatar for IamRasheed

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 …

Member Avatar for IamRasheed
0
103
Member Avatar for kartik_sxn

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

0
120
Member Avatar for katharnakh

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

Member Avatar for vegaseat
0
11K

The End.