15,175 Topics

Member Avatar for
Member Avatar for matthewkeating

I am writing a script that solves a Quadratic equation. What I am doing wrong and why? The error I get is: [COLOR="Red"]Traceback (most recent call last): File "/home/matthew/Desktop/QuadraticSolver.py", line 5, in <module> c1 = (b * -1) + math.sqrt(((b*b) - 4*a*c) / 2*a) ValueError: math domain error[/COLOR] Here is …

Member Avatar for Gribouillis
0
609
Member Avatar for 3e0jUn

How do you make Python delete a specific line of text from a file? For example, delete_input = input ('> ') file = open('blahblah.$','w') #delete the variable delete_input file.delete(delete_input from file) Any form of help would be appreciated. Thanks!

Member Avatar for snippsat
0
81
Member Avatar for 3e0jUn

I have a very tough problem- how do you make an icon/character move across a console screen? For example, if I press W, +++++ ++E++ +++++ Then I press D +++++ +++E+ +++++ And I want it to be like the CHOICE command in CMD- Without requiring the user to …

Member Avatar for 3e0jUn
0
92
Member Avatar for Behseini

Hi, I am trying to create a simple GUI which let user to populate a list box base on a click event in wxpython. Can you please point me into a simple tutorial or example which has a sample? For example I have a list of colors: Red, Green, Blue, …

Member Avatar for Behseini
0
149
Member Avatar for HTMLperson5

Is there any way to remove an imported library? `Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32` `Type "copyright", "credits" or "license()" for more information.` `>>> dir()` `['__builtins__', '__doc__', '__name__', '__package__']` (Currently imported packages) `>>> import time` `>>> dir()` `['__builtins__', '__doc__', '__name__', '__package__', 'time']` …

Member Avatar for HiHe
0
409
Member Avatar for kwolfe

Hi, I'm a newbie to Python and trying to write my first FTP script. Here's the code: from ftplib import FTP ftp = FTP("LoginServer.com") ftp.login("LoginID", "Password") # open the file to read it f = open("C:/Users/MyDocs/Documents/Python/test.txt", "r") # Open directory ftp.cwd("/") # save file ftp.storbinary("STOR test.txt", f) ftp.quit() f.close() I'm …

Member Avatar for TrustyTony
0
198
Member Avatar for javanub123

im following along in this nifty little book and one of the coding examples just sparked my interest. data = open('some_file.txt') for each_line in data: print(each_line) How does python know what i want it to do without really telling it? i figured i would have to tell it how i …

Member Avatar for HiHe
0
149
Member Avatar for Zeref

Hi guys. So, I'm trying to read data from a database and displaying in a GtkTreeview. I used glade to design the GUI when i click on the button (view movies) the list of movies should display as a list. def on_btnmovies_clicked(self,widget,data=None): store=self.builder.get_object('listmovies') connect=sqlite.connect('movies.db') db=connect.cursor() db.execute("SELECT * FROM movie") for …

Member Avatar for Zeref
0
733
Member Avatar for Iceman10284

Assume that a file containing a series of names ( as strings ) is named names.dat and exists on the computers disk. Design a program that displays the numbers of names that are stored in the file. ( Hint: Open the file and read every string stored on it. Each …

Member Avatar for sepp2k
0
537
Member Avatar for chriswelborn

I started using Python a few weeks ago, something finally clicked and I started writing tools for my personal use. I started writing something with a GUI using GTK and the code lines started multiplying rapidly, so I thought to myself "Am I commenting my source to death? How many …

Member Avatar for chriswelborn
2
361
Member Avatar for javanub123

im trying to write a program that will read a line of text from a file and then print that text into whereever the cursor is in the browser. like into the address bar or something. is the possible with python? how would i go about doing it. i know …

Member Avatar for javanub123
0
119
Member Avatar for ceck30s

Hi, I'm a beginner at python and I'm trying to extract specific columns from a text file, and then use those columns to make a line plot. The files contains the following few lines of data: # Raw SIFs at Crack Propagation Step: 0 # Vertex, X, Y, Z, K_I, …

Member Avatar for Gribouillis
0
749
Member Avatar for KoRnKloWn

I am currently working on an app to convert documents (specifically Open Document Text, at least for now) to epub format. The problem I'm running into right now is this, I am using etree ElementTree to parse the xml files extracted from the .odt file, right now I'm working on …

Member Avatar for KoRnKloWn
0
272
Member Avatar for fatalaccidents

Hey guys, I'm new to parallel programming, so I was wondering if anyone could help me parallelize a bit of code. It is a code that goes into large h5 files (using h5py) and grabs some data out. After that the data has to be reformatted and printed into another …

0
88
Member Avatar for 3e0jUn

How do you make Python delete a string or a number (in this case, .0) from a file? Example: #Error Fixing if '.0' in open('ship.$','r'): #Delete the '.0'

Member Avatar for snippsat
0
482
Member Avatar for pn1925

I am trying to write a python script to open file, read each line, and replace the 18th position of each line with a a user specified character (sysargv[3]) IF AND ONLY IF that 18th position is another user specified character (sysargv[2]). It should then save it as a file …

Member Avatar for pn1925
0
146
Member Avatar for Trak

Hi :) i'm kind of new to this site and everytime I read a thread someone else makes i don't understand what anyone is saying.... :sad: well anyways, please help me python pros. I have been on my very first exercise of "Learn Pyhton the Hard Way" since two weeks …

Member Avatar for brikbrat
0
601
Member Avatar for 3e0jUn

Guys check out http://cx6-dev.blogspot.com/ for an awesome game coded in Python. It's new but still fun. HIGHLY RECOMMENDED! PS: You'll need to have Python 3.2 or above to install/play it.

0
75
Member Avatar for helpneeded87

Hello, I was seeking help in why my small program/script is not performing the way I would like. Here is the question. Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each …

Member Avatar for helpneeded87
0
243
Member Avatar for lrh9

I had been wanting to write an IRC bot with asynchronous IO for a while. My bot responds to pings, but can be extended by defining functions and registering them to get called when the bot receives certain commands. My bot uses the RFC 1459 USER command and parameters, but …

Member Avatar for lrh9
0
261
Member Avatar for TrustyTony

As in C++ was some question about speed of simple hard disk based lookup, here is a version of unscramble program completely HD based lookup, which gives all possible candidate words for multiword anagram. Program is not sensitive for case of words but does not ignore special characters like ' …

Member Avatar for svfox2000
0
1K
Member Avatar for chriswelborn

This is a script that was supposed to be very basic, just running a command with my scripts arguments attached. I didn't realize that if user 'cj' opens firefox, when user 'root' does '**firefox -new-tab**' it doesn't work. Firefox will just open a new window, and thats exactly what I …

Member Avatar for chriswelborn
0
308
Member Avatar for veledrom

Hi, I've started learning Python and want to find out how easy is creating GUI for a software. I used to use VB6 with Visual Studio and it was all about Drag and Drop items on a form. Do we have such thing or we just have to hand code …

Member Avatar for HiHe
0
2K
Member Avatar for 3e0jUn

I have a code for a game. money_file = open ('money.$','r').read() money_file = str(money_file) money = int(money_file) But everytime I run it, it returns an error: Traceback (most recent call last): File "C:\Users\eeo.j\Desktop\CX6 SDK\CX6 Normal\CX6.py", line 86, in <module> money = int(money_file) ValueError: invalid literal for int() with base 10: …

Member Avatar for HiHe
0
149
Member Avatar for kuchi

I've an web page which reads the data from (server side) database and write into csv file, but as per requirement I need to write the file in client side and asked user to save the file in their local machine with popup window to save the location (client side), …

Member Avatar for kuchi
1
755
Member Avatar for JubalBarca

Okay, my problem goes as follows. I've been writing a small program in python (an adventure game) which has hitherto run via the console. I'm now working on giving it a full interface, which is requiring a lot of changes to my rather simplistic/archaic structure and generally making things something …

Member Avatar for sepp2k
0
232
Member Avatar for bobstein

OK, so when I use open(<filename>, 'w') the program either writes to the specified file or creates a new one if it doesn't exist, right? Is there a way to create a folder path or something? Like to create D:\My Documents\Folder and create a file in that folder? How would …

Member Avatar for TrustyTony
0
15K
Member Avatar for 3e0jUn

I've been working on Tkinter, and setting a message box. It worked fine, but I didn't really like the fact that the text displayed was in a small position in the window. Take a look at this code and you'll know what I mean. def About(self): text = Message(self, text=''' …

Member Avatar for 3e0jUn
0
179
Member Avatar for HTMLperson5

Hi, all. I am trying to clear the console window without using the "os" library. This seems like the only way to do it: from os import system import time print "I will clear the screen in 2 seconds" time.sleep(2) system("cls") print "*Cleared Screen*" SystemExit() But the problem is, this …

Member Avatar for 3e0jUn
2
4K
Member Avatar for aekaette

Hello, I am trying to read values from an excel spreadsheet but just for specific cells at a time; say Cell A1 and B1. Then I want to save the respective values into a variable and use the variable through out the rest of the code. Then loop at the …

Member Avatar for belenos46
0
675

The End.