15,179 Topics
| |
Hi all, I'm trying to mimic an html form that calls a script on the web. When I put the form together on a page, it works, and I was wondering if there was a way I could "scrape" this post request and see what I'm missing when I try … | |
Hello, I'm working on a new little project that moniters a configuration file. Everything seems to work great except for when I attempt to do some error handling. The configuration file simply looks like this. # third sets the lights # 0 = off, 1 = on, 3 = lights … | |
So I want to make a program that allows me to press a key (for example a). So when I press a, I want it to type(right term?) a predefined string (abcdefghijklmnopqrstuvwxyz for example). Like once the program is complete, I could go into notepad and press a and it … | |
Hello! I have a little problem. I have to print a table (four columns from an Excel file) in a text box. I took a string and I kept appending all the cells from the file that interested me and I used the textbox provided by easygui. [CODE]textbox(msg='', title=' ', … | |
Hi, I'm a newbie to python and I'm reading a file and trying to split a string every 3 spaces, that is included any whitespace. string.split() will split the string up every whitespace, but is there another way to specify every 3 spaces, whether there is whitespace or not? I'm … | |
Hi, I have slogged my way through, Mark Lutz's Learning Python it is a great book but the problem I have with it is that it doesn't have any practical programing question like the dietel books. Can you guys please tell me a few books with questions that follow the … | |
hi, i just start to learn and doing programming with python (was an old timer programmer in other languages). when i saw a project idea about creating your own squareroot function, i tried it. the problem start was when i try to compare the result of x**2 where x is … | |
I cannot get the code work. I want to use placeholder than a fixed value. When use fixed value it works but not placeholder. Please correct me! [CODE=python] import sqlite3 as sql class Tables(object): def __init__(self): print "Class created!" def CreateDb(self, dbname): self.conn = sql.connect("?", (dbname, )) self.cur = self.conn.cursor() … | |
Hi, I'm trying to run a batch of commands from a .txt file using python. ("cmd.batch.txt" = ~1000 command lines : perl cmd.1.pl -in -parameters) and redirect renamed output files to new folders. It works fine for the first line, but I'm having trouble getting something to loop through all … | |
Hello, I am trying to make a GUI interface for a plotting routine written with matplotlib. The GUI is in PyGtk. One of the things I would like to have is a cross hair through the mouse cursor (a vertical and horizontal line intersecting at the mouse) which moves along … | |
Hey all, Here's my problem: I have a class that I want to be able to save and and load. But I need the class to be mutable I guess. Check it out: [CODE=python]class Tool: def __init__(self,name,function): self.name = name self.function = function self.savename = self.name + '.txt' def save(self): … | |
My question is : How to sort files by name and delete in Python. What i want and mean is: In TextFolder have: a1.txt a2.txt a3.txt a4.txt a5.txt a6.txt a7.txt a8.txt a9.txt a10.txt i wan sort the file by name and i only wan keep 10 files only in the … | |
[CODE=python] import sqlite3 as sql class Tables(object): def __init__(self): print "Class created!" def CreateDb(self, dbname): self.conn = sql.connect("?", (dbname, )) self.cur = self.conn.cursor() def CreateNewTable(self, tablename):#, tablename self.cur.execute("CREATE TABLE IF NOT EXISTS ?(id INTEGER, name TEXT)", (tablename, )) listed = [(1, "Mary"), (2, "Martha"), (3, "Jesca"), (4, "Don")] for i … | |
I need help with writing a program that asks the user to enter distance in kilometers and then converts distance to miles | |
I appologize for the length of this post, but I have no clue what is wrong with my program. As an experiment, I wrote a XOR encryption program. It isnt very fast, but it works. Apparently, only for strings. I implemented a file encryption function, and it seems that some … | |
Hello, I am aware of programs such as py2exe and py2app for converting python to standalone windows and mac apps and have gotten those to work for most things, but I'm not sure about the best way to transfer to the Linux platform. The problem is the program I have … | |
| Hey guys... I have some code here: [CODE] import os import threading import urllib import time a=0 class launch(threading.Thread): def start_now(): try: urllib.urlopen("http://www.google.com") except: a+=1 start_now() def end(): print("\nOut of 10000 requests, "+str(a)+" requests failed.") for x in range(10001): launch().start() print("http://www.google.com") end() raw_input("<Done>") [/CODE] This works, in the sense that … |
Hi all,:'( his for over a week now i cant get my head round it so i hope some one can help me... i have a dictionary which reads my file line by line and counts the occurance of tuples ...ok great. then for every key in my dictionary (which … | |
I am new to regular expressions, but I do not get why this is not working : [CODE] import re inputstr = "HI\n//asgwrg\nasdg" re.sub("\/\/(.*)(\n)", "\n", inputstr) [/CODE] I am trying to substitute everything between "//" and newline with newline. Can someone tell me whats wrong? I am using python 3.1 | |
Okay so when I open a file and I would like to pickle something to the file you are supposed to open the file in 'rb' (read binary) mode to load stuff from it. If you want to dump something the file is supposed to be in 'wb' (write binary) … | |
Hi, I have got a little problem with __setitem__ method. It works fine in single class, but if class member is instance of the same class method __setitem__ doesn't work on class member but on class. Here is an example: Here is a class with __setitem__ method: [code="python"] class MyClass: … | |
Hello, I want to use an new library i downloaded e.g. chilkat library ([url]http://www.chilkatsoft.com/python.asp)[/url], how do i do that ? I tried to put on the beginning of my code: [code=python] __path__ = ["dir_with_chilkat_pyd"] require chilkat [/code] but does'nt work. What i want to run: [url]http://www.example-code.com/python/http_loginForm.asp[/url] | |
Why don't either of these implementations actually write to the file? Code v1: [CODE] txtfile = open('C:/Python31/SKUs.txt', 'w') with txtfile: num = 817 while num <= 820: x = "G" + str(num) print(str(x), end=" ") num += 1 txtfile.close()[/CODE] Code v2: [CODE]txtfile = open('C:/Python31/SKUs.txt', 'w') num = 817 while num … | |
Hi all. I'm having a bit of trouble (maybe it's easier than I think..) finding the lowest and highest number in a tuple of lists. Here is my main tuple: [CODE=python]list_of = ([0,7],[100,25],[150,59],[300,189]) [/CODE] so pretty much, I need python to return the lowest and highest number for each 'item' … | |
Hi there. Iim wanting a button pressed to do TWO commands .. one after another. EG. instead of my current code musicbu = Button(root, text = 'Backup Music', width = 17, command = musicback1) and musicback1 is a def (): with a complete and working script, i wondered if i … | |
Hi guys, firs of all, im sorry for my bad english.. How can i learn OOP, its really hard and detailed. Firs of all, i dont know why i must use OOP. Thanks.. | |
Sigh. This error keeps appearing, and never ceasing -- ever: [CODE] *** Unrecoverable, server exiting! ---------------------------------------- ---------------------------------------- ================================ RESTART ================================ >>> Unhandled server exception! Thread: SockThread Client Address: ('127.0.0.1', 4323) Request: <socket.socket object, fd=1856, family=2, type=1, proto=0> Traceback (most recent call last): File "C:\Python31\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) … | |
I can't figure out how to make the stars go from 5 back down to 1, printing only 1 star at a time, I did half of it but now I'm confused. Here's the first part I've done:[CODE]#nested for loop # index = "*" count = "*" for index in … | |
i just got into this python thing and i asked my friend how to do this and he doesnt know he told me to write this here so you guys can understand how to make an if statement (if x == 10 to 24) with proper syntax | |
Hi I am developing a small application in that i have only labels. My Output like this.. S.No Customer Name Customer Code City 1. Raja 1242 Vsp 2. Sekhar 1243 Hyd 3. Ram 1244 Bang Hear i want to develop my application with one control ie, for example i have … |
The End.