15,181 Topics
| |
Hi, I don't understand how to write unix shell commands in python. I have this txt file were I want to delete duplicates. It looks something like this: RTGR.txt FRTO.txt RTGR.txt SDOP.txt QWJL.txt SDOP.txt FRTO.txt FRTO.txt ...etcetc... I think I'm suppose to import os and then I want to use … | |
ok for one... I must say I'm a noob at classes, but have made some pretty good apps using nothing but functions. I'd like to get into classes though, and every time I try, I end up misunderstanding 1 or 2 things and messing the whole thing up... <:\ can … | |
Hi guys, I have a difficult problem to solve. I have a list with 4 columns of values as follow 750.633 379.039 652.524 1112.63 930.491 452.16 842.753 1191.78 882.063 446.411 787.56 1183.43 434.362 410.174 325.863 1145.34 954.426 445.297 865.449 1183.74 1233.67 194.909 1155.27 908.305 1505.97 917.95 1441.07 1698.01 852.882 133.219 … | |
Hi, I find in all books and websites that in order to run a Python script from the command prompt, I have to run something like this [CODE]python example.py 1.3[/CODE] where [B]example.py[/B] script is provided with an argument of 1.3. However, it is not working for me in Windows 7 … | |
Hello all. So I am trying to write a program that will read in a text file, then it will scan the file for prompts, such as %[color], %[noise], etc. Then from what prompts are within that file, the program will ask the user what word they would like to … | |
My goal is to output monthly cost insrance for entered employee id, but my program keeps giving me a error idk why [CODE]import sys #empfile=raw_input("Enter Emp.file Name:") #emp=sys.argv[1] #print emp #usage : run it as follows from command line. #python db.py employee.txt InsurancePlans.txt InsurancePolicies.txt def dict2(lines): dict={} for l in … | |
I'm having difficulties splitting up a string (that I read from a textfile) into three parts in a list (that I will then use in a function). The issue I'm having is that the 3rd element of the string is not always one word (sometimes its multiple words, but I … | |
i need to use crossfade function to to this. i need some help please, i am new at this. any help would be great. i have done a program than makes a double image but this need to happen slowly. | |
Hey, I have pylab and I want to plot a histogram of the following : Basically I generate a random integer between 0 and 1.0 about 10,000 times and then I want to arrange each integer into a separate bin of the histogram so I can see on the histogram … | |
Hi guys, I'm having problems with wxPython. If I put in the header of my files from wxPython.wx import * it works fine, even if I see a DeprecationWarning about it. If I write import wx (as also wxformbuilder would do) I get errors like name wxPySimpleApp is not defined … | |
Hi all, I wrote this somewhat simple script that is suppose to change and update polygon GRIDCODES based some rules. The shapefile is reclassified into likelihood of conversion. So the code is set up to get the GRIDCODE value of all adjacent polygons to the cursor polygon. I put these … | |
I'm having trouble creating a function with one parameter that reads from a file and then creates and returns a dictionary based on what's in the file. And example of whats in the file: [ICODE]115 139-28-4313 1056.30 135 706-02-6945 -99.06 143 595-74-5767 4289.07 155 972-87-1379 3300.26[/ICODE] What i have: [CODE]open('balance.txt', … | |
I have a large number of files that begin with numbers (e.g., 10admin_boundary_x) and would like to rename the files so that they do not begin with a digit (e.g., admin_boundary_x). I am working with shapefiles (.shp, .shx, .dbf, etc) and thought a python script could save me some time. … | |
Hi.. this is not a "which is better" thread, although if you happen to have a reason for thinking so, please share your thoughts. First I just want to say that I do not want to have any flame wars or arguments or anything like that. Please keep emotional arguments … | |
1)Write Python code that asks the user for two angles of a triangle. Then, first determine if the triangle can exist (make sure that the third angle can be found such that the sum of the three angles is 180°, with all angles both given and computed conforming to the … | |
[CODE]import math print "Select unknown variable" print "a, b, or c" print equation=input("> ") if equation == a: b=input("Enter b: ") c=input("Enter c: ") a=math.sqrt(c ** 2 - b ** 2) print "a= ",a [/CODE] **i get the following traceback Traceback (most recent call last): File "C:\Python27\My Programs\pt.py", line 7, … | |
I have a number of lists such as ['BLAH', 19, '11111', 'Fa0/19', '100000000'] I either need to make a list of lists or a dictionary containing lists. What would be the recommended one to do and will make the process of further sorting and text manipulation the easiest. Thanks, | |
How do I make a transparent window in Tkinter? | |
1 the computer displays some secret word(in underscore):--- 2 I guess letter"c"in the word 3 yes,the screen pops up like this :c-- 4 I guess the second letter is u 5 yes , it is :cu- 6 last ,I guess the final one is p 7 yes , it is … | |
Hello, I am learning classes and object and I have a problem with this code. Simply does not work. Can you tell me the reason please? Error message tells me that Distance is not defined...(I don´t understand this message) Thank you for help! Vlady [CODE]class Distance(object): 'return distance between 2 … | |
Hi, this is my first post. I apologize if I make any mistakes. I have a problem where I need to take a list and print it out as a table of average for each person. The list is : [('tom',4),('ben',5),('tom',8),('ben',12)] So far my code is: [CODE]def getAverage(list): list = … | |
Hi, I need to integrate e^-(x^2) between negative infinity and positive infinity, now the function vanishes to a minute value much before negative and positive infinity. I need to approximate the integral using the trapezium rule, which I have coding for but I just don't know how to apply it … | |
i am writing a program that reads the file i create. The file has grades and weights of grades anddd 3 person but i need to create a program that will read the information from the file, calculate and print the total average of each student given by the formula … | |
Hi everyone! This is my first post even though Ive been reading you for a while. I'm a Python beginner and I'd need your help. I'm processing a very big file (more than 2 millions of lines) but I'll show you a much smaller example (24 lines rather than 74513). … | |
Im a beginner to python and my professor has assigned the following assignment: You buy an international calling card to India. The calling card company has some special offers. a) If you charge your card with $5 or $10, you don’t get anything extra b) For a $25 charge, you … | |
How to suppress end user ability to edit/add/delete text in a Text widget? (Python v3.2.. and tkinter) The point is to [B]suppress only the ability to change/add/delete text[/B] but not to castrate other features. Perhaps a NoEdit Text widged would be a better name. I've tried [B].text['state'] = 'disabled'[/B] and … | |
[CODE] for elem in sentence: .setdefault(elem, 0) repeat[elem] += 1 print sorted([ (freq,elem) for elem, freq in repeat.items()],reverse=True)[:3] print repeat [/CODE] i have this loop which analyses the elements in the loop and then prints by frequency, i wanted to print by frequency and alphabetically. example [(5,apple),(5,orange)] | |
I'm trying to use cx_Freeze and everything everything seems like it should work fine, however I'm getting an import error for import tkinter [CODE]Traceback #... from tkinter import __fix #... import_tkinter ImportError: DLL load failed: The specified module could not be found.[/CODE] This only happens when I take the the … | |
im trying to write a code that i can input a,b,c and the code will run it in the quadratic formula and give me the answer but i keep getting a error problem import math from math import sqrt print print ("Welcome to the Quadratic Program") print ("--------------------------------") print a=input("Enter … | |
hii I am trying to develop a simple image browser.this is wat i have done so far [CODE]from Tkinter import * top=Tk() def search(): global pic global photo pic=PhotoImage(file='images\\pic.gif') photo=w.create_image(250,200,image=pic) w=Canvas(top,height=500,width=500,bg="white") entry=Entry(top,bg="white") nxt=Button(top,text="next",activebackground="blue",command=next) prev=Button(top,text="prev",activebackground="blue") b=Button(top,text="search",activebackground="blue",command=search) b.pack() entry.pack() nxt.pack(side=RIGHT) prev.pack(side=LEFT) w.pack() top.mainloop() [/CODE] as u can see it will display a … |
The End.