15,175 Topics

Member Avatar for
Member Avatar for revenge2

Does anyone know of any good urllib tutorials other than [url]http://www.voidspace.org.uk/python/articles/urllib2.shtml#introduction[/url] & [url]http://effbot.org/librarybook/urllib.htm[/url]. Something which a little beginner friendly:| with good explanations. -Thanks

Member Avatar for mn_kthompson
0
200
Member Avatar for wheatontrue

Dear all, I am trying to create x attributes in a class, to the effect of: class classic: def __init__(self,text): r=range(text.count('TI -')) for l in r: self.l=None Unfortunately I can't iterate through for some reason. I only get self.l, not, for instance self.1 to self.107 How do I do this? …

Member Avatar for wheatontrue
0
80
Member Avatar for scru

Is there a gui library that has already been ported to python 3? I'm interested in using some of the new python 3 features in the back end for my project.

Member Avatar for Ene Uran
-1
266
Member Avatar for NarendraRoy

Write a function which starts N processes in a ring, and sends a message M times around all the processes in the ring. After the messages have been sent the processes should terminate gracefully. How do we solve in in python please help me by giving the script or logic.

Member Avatar for Murtan
0
141
Member Avatar for Stefano Mtangoo

I know of ww.portablepython.com/ Can anyone know how to do a combination of IDE and this python in stick. Also if anyone have ever tried to add other python modules to it like Vpython, wxpython, etc Thanks alot

Member Avatar for Stefano Mtangoo
0
386
Member Avatar for mmxbass

Attempting to scroll a simple background using pygame. This is proving to be near-impossible. It seems that once a surface is blitted anywhere, it WILL NOT blit into a new location. My two problem functions: [CODE] def loadMap(self): vid = _video._Video() self._bg = self._map.get_background().get_pyImage() self._fg = self._map.get_foreground().get_pyImage() vid.paint(self._bg,0,0) vid.paint(self._fg,0,0) def …

Member Avatar for mmxbass
0
110
Member Avatar for tondeuse34

Hey guys, [CODE]import sgmllib class MyParser(sgmllib.SGMLParser): def parse(self, s): "Parse the given string 's'." self.feed(s) self.close() def __init__(self, verbose=0): sgmllib.SGMLParser.__init__(self, verbose) self.hyperlinks = [] def start_a(self, attributes): for name, value in attributes: if name == "href": self.hyperlinks.append(value) self.newhyperlinks.append(name) def get_hyperlinks(self): return self.hyperlinks import urllib, sgmllib f = urllib.urlopen("http://www.python.org") s = …

Member Avatar for scru
0
150
Member Avatar for Ghostenshell

Can someone explain how to add a file to a dictionary. The file is simple. Maybe a word or a number on each line. Here is the code I have. Didn't know if i should use this post or the List and Dictionaries post so kind of posted twice... sorry …

Member Avatar for woooee
0
133
Member Avatar for wotthe2000

Hi I'm getting the error TypeError: argument of type 'int' is not iterable when i run my program and don't know where I'm going wrong. My code is: [ICODE] class loan: global loanlist loanlist = [] def loanbook(self, name, ISBN, author, title): self.name = name self.ISBN = ISBN self.author = …

Member Avatar for Ene Uran
0
4K
Member Avatar for adam291086

I am trying to set a cookie but when i check my browser cookies nothing is set. What am doing wrong [CODE] #!/usr/bin/python # e begoli, python connector for mysql # import MySQL module import MySQLdb import cgi import Cookie import time cookie = Cookie.SimpleCookie() cookie["ID"] = "" print "Content-type: …

Member Avatar for adam291086
0
220
Member Avatar for SoulMazer

Hello, if you have seen any of my other posts you will know I am working on a script to make a "vocabulary test". I currently having it functioning nearly perfectly, except I get an error if I enter the wrong word. Code: [code=python]def vocabtest(): for r in words.values(): count …

Member Avatar for SoulMazer
0
97
Member Avatar for wotthe2000

Hi I have certain number of books which each have an author, title and ISBN number. How is the best way I can store this so that when I want a list of the books I will be able to list the books with the title, author and ISBN number? …

Member Avatar for Ghostenshell
0
151
Member Avatar for adam291086

In php you can use $_GET['adam'] to get the information from adam in the url Can you do the same in python? if so how?

0
74
Member Avatar for thehivetyrant

[B]Hi i've been assigned with doing a torn square, and i've kinda got it working with the code below.[/B] [code] import turtle turtle.reset() length=100 degree=60 i=0 while i < 4: turtle.forward(length/length*40) turtle.right(degree) turtle.forward(length/2) turtle.left(degree+degree) turtle.forward(length/2) turtle.right(degree) turtle.forward(length/length*40) i+=1 turtle.right(90) else: raw_input("there's hopefully a square, all torn like!") [/code] as you …

Member Avatar for thehivetyrant
0
489
Member Avatar for mrpoate

Hi, I'm currently working on a project in Python 2.6.1 using the Tkinter interface, and being new to both Python and Tkinter I've quickly found a problem that keen internet trawling hasn't seemed to help. I'm sure its not a particularly difficult problem or anything, but instead of spending probably …

Member Avatar for mrpoate
0
132
Member Avatar for OffbeatPatriot

At my lab the professor bought a camera that came with a c library to control it from a computer. Right now he wants me to create a gui in matlab to control it but I'm such a python zealot I'd rather do it in that, and then call it …

Member Avatar for OffbeatPatriot
0
252
Member Avatar for scru

Is there a way to add a directory to the locations that python look at when you call __import__ ? I need to import some scripts from a user folder at runtime, and since __import__ doesn't accept absolute file names, I'd like to try this. Copying the script to the …

Member Avatar for scru
0
137
Member Avatar for revenge2

Hey guys, well here are some more of my questions (sorry!! i know, im a pain..) Ive finished "most" of everything in this [URL="http://www.swaroopch.com/notes/Python_en:Table_of_Contents"]tutorial[/URL]. I missed some out because they were too much for me to understand at the time. will go back to them and come back with more …

Member Avatar for Ene Uran
0
122
Member Avatar for EAnder

I know the codes not the best well written but the only problem I'm having(besides the interpreting of the macro commands, the one here is just a base for me to work on) is how the UpdateLabels.start() method returns: [code]Traceback (most recent call last): File "C:\Users\Erik\Desktop\Stuff from last Night\MouseMacro.py", line …

Member Avatar for Ene Uran
0
114
Member Avatar for revenge2

hello again, Ive got the basics under my belt and ready to start making things happen:D. I want to experiment with different things so could you show me to some good tutorials on some of the following things. 1. sending and receive messages through the internet-what library/Mod should i use? …

Member Avatar for Ene Uran
0
103
Member Avatar for harrykokil

hello guys im stuck for quite a while with this problem and i badly need ur help. in fact i wanna make the red rectangle slow down when it comes close to the blue one. it would be nice if they both move at the same speed. ive tried several …

Member Avatar for harrykokil
0
75
Member Avatar for mrpoate

Hi, This is my first time on daniweb, so if I've posted in the wrong section or there's already a similarly-themed thread or I've done something wrong I apologise. Anyway, I'm hoping someone can prod me in the right direction with a problem I'm having right now. I'm currently working …

Member Avatar for mrpoate
0
2K
Member Avatar for jworld2

Okay, my first question is about wxpython's registerhotkey. As far as I can find, there are not letter key keycodes. This example relies on the win32con module: def regHotKey(self): """ This function registers the hotkey Alt+F1 with id=100 """ self.hotKeyId = 100 self.RegisterHotKey( self.hotKeyId, win32con.MOD_ALT, win32con.VK_F1) -- I want to …

Member Avatar for lllllIllIlllI
0
161
Member Avatar for adam291086

I am trying to write some simple information to a file and i am getting the error message "No such file or directory when i know full well it exists. If you take the url [url]http://www.adamplowman.com/uni_project/log.txt[/url] you get the file heres the code [CODE]#!/usr/bin/python print "Creating a text file with …

Member Avatar for Gribouillis
0
118
Member Avatar for juzzy

hi I wonder if anyone can help? I am trying to write a simple server_side message reciever so i can send messages from one machine to another, I want the program wrapped in a gui and i have been doing this using tkinter. However I have a problem, I can …

0
45
Member Avatar for adam291086

I am trying to construct a class and call upon some functions within that class, but nothing is returned, somehting should definitely be returned [CODE] #!/usr/bin/python import cElementTree as ET import urllib2 import MySQLdb print "Content-type: text/html\n" class xml: @staticmethod def find_text(element): if element.text: yield element for subelement in element: …

Member Avatar for adam291086
0
169
Member Avatar for Clipper34

Hey everyone, well i've been recently for the last day pondering on the idea of creating a web spider, but i just don't know where to start. What i think mainly the spider is built off of using the urllib, socket, and urllib2 modules to do the spiders bidding, i …

Member Avatar for woooee
0
128
Member Avatar for TheNational22

There is a thread in here somewhere that spoke of the issue but it did not describe a fix. I am running Vista home premium 64-bit SP1. When I open a wxPython window, it runs. As soon as my mouse enters the frame, a message comes up stating "python.exe has …

Member Avatar for TheNational22
0
93
Member Avatar for ruba_cti

Hi, I'm getting this error when reading from a csv file: "Runtime Error! line contains NULL byte". Any idea about the root cause of this error? If it helps, here's the part of my code where I'm reading the csv file. [QUOTE]def processFile(): global DATA # - Input file global …

Member Avatar for ruba_cti
0
2K
Member Avatar for harrykokil

can u plz debug it for me?? thanks [icode] import Tkinter as tk import time import sys import datetime as dt from Tkinter import * root=tk.Tk() root.title("Traffic Simulation") canvas = tk.Canvas(root, width=1000, height=400, bg="#FFFFFF") canvas.pack() for x in range (1,10): print 'orange'+x canvas.update() root.mainloop() [/icode]

Member Avatar for harrykokil
0
93

The End.