14,951 Topics

Member Avatar for
Member Avatar for Your_mum

Right, so I looked at some python tutorials about interfacing with internet, but every time a use a code such as: [code] import urllib pagetext = urllib.urlopen("http://www.python.org.html").read() print pagetext [/code] It just comes up with a load of error messages. how can i sort this

Member Avatar for vegaseat
0
125
Member Avatar for johndoe444

Hi, I have this code: list = ['12 angry men', 'Rash &# xf4;mon'] [CODE]def func(list): ... for e in list: ... e = re.sub(' ?&# x([0-9a-f]*);',r'\x\1',e) ... print type(e) ... e = unicode(e,'iso-8859-1') ... print type(e) ... print e[/CODE] I get this output: [CODE] 12 angry men Rash\xf4mon[/CODE] whereas I …

Member Avatar for The_Kernel
0
164
Member Avatar for a1eio

i've made a little animation using python and the pygame module, I'm just wondering if it's possible to turn that into a screensaver? is there a format i have to save it to? If anyone knows i would be grateful for the solution thanks, a1eio

Member Avatar for Stefano Mtangoo
0
2K
Member Avatar for abbiejoy21

I'm brand new to python (and programming) and trying to write a script that will download a .csv from the Internet and then allow me to plot data from the .csv. I already have the plot working, and I can grab the file locally, but I can't figure out how …

Member Avatar for jlm699
0
294
Member Avatar for johndoe444

Dear friends, I have this code which attempts to get the last modified date of an http resource: [CODE]request = urllib2.Request('http://www.imdb.com') >>> opener = urllib2.build_opener() >>> request.headers {} >>> first = opener.open(request) >>> first.headers.dict {'transfer-encoding': 'chunked', 'set-cookie': 'session-id=209.251.138.146.1246519635845007; path=/; domain=.imdb.com, uu=bN4RO5T1YWqLBgRAupwcdgCRSyzj0j26pvJ+qYPCXqmT117Zs9L+/LfGO4zGx50bwJFtjNPSXuqj8g4pgDJ+meCRbaoGcS2aoNZb7PiBbbqjkm66I/I+qSAyfpnj8l7qA/I+qTAyfpngkW2KBnEtmqDXe20AkW26oLFtuqC3KyrjwW26o5IOuZOyLtnAgc0ZsLFtuqCRbergwR2Ko=;expires=Thu, 30 Dec 2037 00:00:00 GMT;path=/;domain=.imdb.com, cs=xOA2Pyx3xsSbt7wMU8ZOhAbGfbqgkW2NmIHl2qPyXuoj8j6pMDJ+meCRbYoGES2aoJFb/feFHbqjsg7/p9HNySCRWyxAGW26oKdbraCRbbqgsW26oJFt+uDBHYqg==;expires=Fri, 03 Jul 2009 …

Member Avatar for siddhant3s
0
217
Member Avatar for kes_ee

How to acheive this in Python? [QUOTE]Converting the string "HelloPythonWorld" to "HELLO_PYTHON_WORLD"[/QUOTE]

Member Avatar for shadwickman
0
168
Member Avatar for johndoe444

Hi, This is the existing code: [CODE]for c in chartNames: chartUrl = baseChartUrl+c hd = extractChart(chartUrl) writeChart(hd,c) for key in hd: if key in chart: chart[key].append(c) else: chart[key] = [c] [/CODE] when i wanted to insert a line before [CODE]chartUrl = baseChartUrl+c[/CODE] by putting the cursor to the end of …

Member Avatar for jlm699
0
159
Member Avatar for Zetlin

Hi everyone it's been almost a year since I gave up programing in python so I have forgotten a lot of things, so just bare with me. Ok so I was playing around with python and ended up with this little program. [code=python] def test(): number = input("Number: ") scale …

Member Avatar for jlm699
0
110
Member Avatar for kes_ee

I am having a text file contaning the following: "int Function1 (int arg1, "0|1", char * arg2); int Function2 (int arg1, " ", char * prt1); ..." I need to open this file, split the each word and store it as global variable. I did this in Perl but now …

Member Avatar for Lardmeister
0
799
Member Avatar for gudivada213

Hi, i wrote the socket script in python, Here both server and client running in under same machine. operating system is ubuntu 8.10 desktop version. [B]tcp server[/B] [CODE] 1 #!/usr/bin/env python 2 3 import socket 4 import sys 5 6 server_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) 7 server_socket.bind(("", 5000)) 8 server_socket.listen(5) 9 while …

0
83
Member Avatar for grisha83

Hello, I am new to Python. I am trying to start writing some simple programs in it. Which IDE would you suggest? I am currently using NeatBeans for my Java programs but i don't think i can use it for Python P.S. I am using Mac OS X 10.5.7 Thank …

Member Avatar for vegaseat
0
100
Member Avatar for arinlares

I'm working on learning on programming with Pygame by following a tutorial linked from the Pygame site. I seem to have stuck myself in a hole, however, because I can't seem to set keys to do different things within the program. I'm trying to first close the program by pressing …

Member Avatar for arinlares
0
6K
Member Avatar for daviddoria

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 …

Member Avatar for daviddoria
0
136
Member Avatar for tehbrozor

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 …

Member Avatar for jlm699
0
157
Member Avatar for hughesadam_87

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 …

Member Avatar for hughesadam_87
0
85
Member Avatar for harsha_kusam

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 …

Member Avatar for harsha_kusam
0
248
Member Avatar for pyarticles

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

Member Avatar for gissolved
0
139
Member Avatar for gudivada213

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 …

0
59
Member Avatar for dinilkarun

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

Member Avatar for dinilkarun
0
2K
Member Avatar for rajasekhar1242

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 …

0
86
Member Avatar for iliketacos

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 …

Member Avatar for iliketacos
0
251
Member Avatar for Your_mum

This will hopefully be my last noobish question post. Please could somebody explain or link to explanation: 1.yeild 2.return thanx in advance

Member Avatar for shadwickman
0
168
Member Avatar for leegeorg07

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 …

Member Avatar for leegeorg07
0
189
Member Avatar for hughesadam_87

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 …

Member Avatar for hughesadam_87
0
111
Member Avatar for drxnele

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 …

Member Avatar for drxnele
0
268
Member Avatar for Aue

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 …

Member Avatar for leegeorg07
-1
1K
Member Avatar for wdsd

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 …

Member Avatar for BigTurtle
0
99
Member Avatar for sedampatil

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 …

0
48
Member Avatar for OffbeatPatriot

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 …

Member Avatar for OffbeatPatriot
0
251
Member Avatar for Nyaato

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 …

Member Avatar for Nyaato
0
359

The End.