15,406 Topics
![]() | |
If I do something like this: [code] print "%08d" % 2 [/code] It will print '00000002'. However, I want to change the "8" to a "3" at runtime (to get '002' instead). I tried this: [code] MyLength = 3 print "%0" + str(MyLength) + "d" % 2 [/code] but I … | |
Hello, I am trying to write a GUI front (with tcl/tk) for a python module. Unfortunately the module takes parameters and I don't know how to call a python module with parameters without going into interactive mode (I'm running Debian) I can get tcl to run a test module with … | |
Hey guys, Lets say I had two different files, each with a column of data. So: [CODE](File 1) 1 2 3[/CODE] And [CODE](File 2) Friend Foe Fighter[/CODE] In the end, I want to unify these into one large file: [CODE] 1 Friend 2 Foe 3 Fighter[/CODE] Each file has an … | |
Hi All, In my python script i use to run some oracle queries for this i require a library to connect to oracle which is [B]cx_Oracle[/B]. When we were using 9i(oracle).. my script was running fine.. and now when we migrated to 10 G its giving problem... Few lines of … | |
Hi, I posted some Python code on my blog at blogspot [URL]http://pyarticles.blogspot.com/[/URL] . However, it not display my code correctly. How can I do to solve this problem ? Thanks :) Eiwot | |
Hi, I am new to socket programming, I have a generated data for every minute in client side and i want to send this data to server for every minute using python script. Client laptop having Airtel GPRS connection(in moving vehicle) and server desktop at my home. Both client and … | |
Hi All, I am using the following code to write data into an excel sheet: [CODE]# Open the Output Spreadsheet objExcel = win32com.client.Dispatch("Excel.Application") # Creating object to write to Spreadsheet self.xlApp =Dispatch("Excel.Application") # Creating Workbook self.Wkbk = self.xlApp.Workbooks.Add() # Get sheet count intShtCnt=self.Wkbk.Worksheets.Count # Creating worksheets wsObjReport = self.Wkbk.Worksheets.Add() # … | |
Hi friends, I have developed a program with reportlabs module to generate a PDF file on macos x. The pdf file is generated successfully But, i cant open the pdf file automatically i mean manually i click on that file then it will be opened. Also i used this syntax … | |
I need help please. this cgi program works fine only if the user puts in more than 66 chars..i chopped the lines into 66 chars each so they would fit in the textarea the problem is that record comments() works perfectly for writing multiple lines and the \n char in … | |
This will hopefully be my last noobish question post. Please could somebody explain or link to explanation: 1.yeild 2.return thanx in advance | |
![]() | Hi a while back you guys helped me make a good spell checker, now i want to advance it so that if the difference between 2 words is small it will change them, I think i need to use diiflib for it but i don't know how to do itmy … ![]() |
Hey guys, Has anyone here ever used python to produce data files which can be immediately read by excel? I thought at first if I just tab-delimited my data, I could copy and paste an entire data file into excel. This is not the case. When I take a tab … | |
Hi, i am making downloader, and I want to use diferent progressbar for every link (like ff downloader)... I made treemodel [CODE]treemodel = gtk.TreeStore(gtk.gdk.Pixbuf, str, gtk.ProgressBar)[/CODE] and i put in components with this [CODE] def insert_row(self, model, parent, type_image, file, pbar): myiter = model.insert_before(parent,None) model.set_value(myiter,0,type_image) model.set_value(myiter,1,file) model.set_value(myiter,2,pbar) return myiter[/CODE] my … | |
How do you copy and paste the text from every page of a book from Google books View plain text option: For example: [url]http://books.google.com/books?id=r70CAAAAQAAJ&printsec=frontcover&dq=true+devotion+blessed+virgin&lr=&as_brr=1&ei=cwB1SZOcI5j4MO6c-bkM[/url] instead of doing it by hand. Also how do you open a series of table of contents like this: [url]http://www.catholictradition.org/Classics/humility-text.htm[/url] and then 1. copy paste on … ![]() | |
My goal is to write a function that takes a number and returns the number of solutions for that number, a form along the lines of f(a) = x_0 + x_1 +...+ x_n = a. where n can be any number such that n < a. Another restriction that I'm … | |
import csv file = open('signin.csv',"rb") reader = csv.reader(file) rownum = 0 for row in reader: if rownum == 0: header = row else: colnum = 0 for col in row: print '%-8s: %s' %s(header[colnum],col) colnum += 1 rownum += 1 file.close() Hi could any one help me out, i am … | |
I'm making a module to simulate a neural network, speed is an issue so I've written it in c, basically you build the network in python, and then run call a simulate method that is pure c. One thing I want to add is the ability to inject current into … | |
I'm a little stuck on this particular piece of code that I'm working on. I'm supposed to check the contents of 1 text file (original), and compare it with another text file (filter) to see if there's any words that matches up. What I have now is a so-called working … | |
[code=python] def prints(value, ..., seps='', ends='\n', files=sys.stdout): print(value, sep=seps, end=ends, file=files) print = prints [/code] Would this permently overwrite print or just overwrite it while my program is running? | |
Hi, I am pretty new to python and I have a really noobish question: What does %s mean | |
I'm trying to learn wxPython. Unfortunately when I came to China in Jan I had to leave the nice wxPython book in Canada because it was too heavy for my suitcase. So I humbly ask you to bear with my ignorance. As practice (and because I have a practical use … | |
How would I round a number to the nearest multiple of 10? | |
I have the following files: [CODE] # add.py #!/usr/bin/env python import os import Cookie import hashlib import MySQLdb import cgi import cgitb; cgitb.enable() def showform(): reshtml = '''Content-Type: text/html\n <html> <body> <form action='add.py' method='post'> Name: <input type=text name=name size = 15><br> URL : <input type=text name=url size=30><br> <input type=submit value="Add"></form> … | |
![]() | Hi I was asking around for ideas for programs and I was challenged to make a browser, but I have no idea how to do this, do any exist currently? and how could I do it please? ![]() |
![]() | Hey guys, I have some code here which checks the last three characters in the list: [CODE]site_list= ['C', ':', '\', 'D', 'o', 'c', 'u', 'm', 'e', 'n', 't', 's', ' ', 'a', 'n', 'd', ' ', 'S', 'e', 't', 't', 'i', 'n', 'g', 's', '\', 'S', 'r', 'a', 'v', 'a', … ![]() |
Whenever I run this code, it always returns an empty list, can someone tell me why this is happening? [code=python] ## Written by Tom Tetlaw ## Copyright (c) 2009 ## Written in IDLE<www.python.org> import sys, os import re sys.path.append('E:/Tom's Personal Project/engine') import shared.useful.Useful import shared.charactors ##TODO: ## Make the Monster … | |
Hello everyone, I'm new to pyhton and this is my first post. Please help me understand how can I tell python where my parallel module is located. parallel module I think is located under parallel folder. Any help will be appreciated... [CODE]import sys sys.path.append('C:\\Python26\\Lib\\site-packages\\parallel') class HelloWorld: _reg_clsid_ = '{BEA1AA48-1D0A-4D19-8E98-03C54F195B59}' _reg_desc_ … | |
I have this python file: [CODE] #!/usr/bin/env python import os import Cookie import hashlib import MySQLdb import cgi import cgitb; cgitb.enable() def showform(): reshtml = '''Content-Type: text/html\n <html> <body> <a href="register.py">Not a member? </a> <form action='login.py' METHOD=post> Username: <input type=text name=person value="New User" size = 15><br> Password: <input type=password name=pass … | |
hi I am developing multiple online game, in networking side i don't know which server is best. along with this please help in twistedpython programming also,I have small doubt in this how van i run the twisted python programme in windows operating system,whenever i run that pogramme in windows o.S … | |
I am reading chapter two of the Pylons [url="http://pylonsbook.com/en/1.0/installing-pylons.html#quick-start-to-installation-for-the-impatient"]book[/url]. In the text I am told to run: [code]$ python virtualenv.py --no-site-packages env[/code] This is what I got back: [code]$ python virtualenv.py --no-site-packages env New python executable in env/bin/python Installing setuptools........... Complete output from command env/bin/python -c "#!python \"\"\"Bootstrap setuptoo... " … | |
I am extremely new to python (programming in general too). I am the rooms director for a large hotel. The reason I am attempting to learn python is to create simple programs to help streamline some of the easy, but lengthy processes done by both my front office and housekeeping … | |
![]() | Hey guys, I want some of your help.... How do I make a keylogging application in Python [I]without [/I]using pyHook? Any other module for that? I heard that learning about [I]threading [/I]will help...is it true? Thanks guys... |
i'm suppose to write a program with two classes, the first class takes two numbers and adds them together. the second class has no methods but has an object called add2. this is what i got class Adder1 (object): number1 = int(input("Give me a number:")) number2 = int(input("Give me another … | |
[code=python] total = 0 max_score = -1 min_score = 100000000 total_numbers = 0 x = 0 y = 0 print("Enter a list of numbers, (Enter -1 to stop) ") print ("Press the enter key after entering each number") print ("End the list by entering -1") print () number = int(input("")) … | |
Hi. Before I start I'll just let you know that this isn't for school, I'm just doing python as a hobby which I have pretty much taught my self. I'm working on a project, it is the "cheat!" card game written in python, currently CLI but when it is bug-free … | |
Hey, I'm not new to python but I wouldn't say I'm use to python either, I am very limited to what I can do, but I was wondering if anyone could give me some ideas for some simple programs that will teach me usefull things to learn. Thank you very … | |
Is there a different version if IDLE for Python 3.0(Python 300, Py3k)?? If there is, how do I download it? | |
![]() | Can anybody gimme a link to a good msvcrt tutorial, because I want to learn getch() badly! |
Hey all, I just recently got into wxpython for my job and I ran into a snag. When print previewing (using the demo code) there seems to be an insane amount of pages, yet only a few of them are viewable. So my questions are: 1) Why is there an … | |
![]() | I wanted to make a Python prog just for fun, to get a pattern like: [CODE] * ** *** **** ***** ****** ******* ******** ********* **********[/CODE] So, basically, I started off by making a script to simply print [CODE] *****[/CODE] using a loop. Here's the code I used: [CODE]import time … |
How do you specify a certain path for the import thing to import? such as [icode]import "E:\Tom's Personal Project\engine\shared.py"[/icode] Any help would be appreciated :) | |
I'm running a portion of code in a loop. It accesses a global variable only to print it, and that variable is never changed after it is set in the __init__. However, the first print statement occasionally will fail, but the second one does not. Any ideas as to why … | |
Hey guys, When using the glob import, I want it to scan all of the files in a directory, but not scan other directories in that directory. For example, say I am in a directory with the following files: [CODE]file, file1, file2, DIRECTORY1, DIRECTORY2[/CODE] When I use the glob command: … | |
I want to create subfolders in already existing subfolders. For example, I have a rootdir with about 50 subfolders in it. In each subfolder I want to create about 5-6 new folders depending on the filename in the subfolder. Confusing? YeahIknow.. I think I know how to create new subfolders … | |
Hi, I want to make a program that opens a url, finds the data I need, and returns it to me. The problem is I have to login to the website, and I don't know how to do this. I've looked at some examples, and this is what I have … | |
where does the print() subroutine, subprogram, or function exist? sure, you "call" it so it can return a value or result, but from where? from where do you "call" it? where does it exist? i don't understand!! | |
Hi, I'm new to both python and Wxpython so I was wondering if someone could help me with a problem I have. I made a button that runs the UpdateNebula function. the function takes a string called path but I haven't been able to find a way to have the … | |
Hey guys, A while ago, with your help, I was able to create a code which scans a data file for names, and when a new name is found, it appends it to a list. For each entry is the list, the code then opens a new file for each … | |
Hello, I am creating a figure with matplotlib and want the legend background to be transparent, I did this with: [code] lg = matplotlib.pyplot.legend(labels,markerscale=0) lg.legendPatch.set_alpha(0.0) [/code] And when i ran it it works but when I save it to an eps (which is the format I need it in) The … |
The End.