15,190 Topics
![]() | |
Hi, I want to read a line in the file and check the content in the line, for example if the line starts with the text "sample test ..." i want to check wether the line starts with sample, but my code always return no result even thou the file … | |
Hi, I am trying to write a connect four program in python, which I am not very experienced at. This is what I have so far: [Code] row7 = [' ', ' ', ' ', ' ', ' ', ' ', ' '] row6 = [' ', ' ', ' … | |
I have no idea how to get started -Prompt user for an integer -If the number is even, divide it in half - If the number is odd, multiply it by 3 then add 1 - If the number reaches 1, stop; otherwise go to step 1 -Use while loop. … ![]() | |
G'day I'm currently using socketserver to build a simple XMLSocket (an XML based protocol used for communication between flash and the outside world) server. I've got flash establishing a connection, sending a request and my python server responding. However at this point socketserver terminates the connection. Which is bad, since … | |
Having trouble understanding using wxPython....:?: [CODE=Python] import wx class MainFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,wx.ID_ANY, title='Hello wolrd') self.buthello = wx.Button(self, wx.ID_ANY, label ='helo') self.buthello.Bind(wx.EVT_LEFT_DOWN, self.helloevent) self.Show() def helloevent(self, event): msg = 'hello' msgbox = wx.MessageDialog (self, message = msg, style = wx.OK) if msgbox.ShowModal() == wx.ID_OK: msgbox.Destroy() app = wx.App(redirect = False … | |
I am trying to print out some database resutls as follows [CODE] cursor.execute("SELECT * FROM User") numrows_user = int(cursor.rowcount) i_user = int(0) Results_user = cursor.fetchall() while i_user < numrows_user: print Results_user[i_user]["ID"] [/code] Put i am getting nothing i know i_user is working and i know there is information in the … | |
Looking for some help catching flash as3 POST command with python. Anyone done this? below is my AS3 Code:(I have on pretty good authority that this part is right) [code] function savedata(event:MouseEvent):void { trace ("i've been clicked"); var myData:URLRequest = new URLRequest("user_info.py") myData.method = URLRequestMethod.POST var variables:URLVariables = new URLVariables() … | |
Dear all, I downloaded a google API interface from [url]http://blackcodeseo.com/google-search-api-for-python/[/url] pretty nice. I was sad to hear that google wasn't giving out access keys anymore for their API, but this one seems to work well despite that - I don' t really know all the details, I just plugged-n-played. The … | |
I noticed a weird thing happening when i use this function. If the page i open is in latin-1 encoding, the bytes returned by this function would have some weird junk characters inserted in various places. However, if i use urlretrieve to fetch the page to disk, there is no … | |
Hi! I want to get information from a sports web site (ex:[url]https://www.bwin.com/pt/futebol)[/url], and I already tried htmllib and some other stuff.... the problem is that I can get the page's source code but not the same information that I can see in my browser. Particularly, I'm interested in the teams … | |
Hello, I'm writing my code into the 'vizard python editor' and sometimes it feels a bit bugged or something, now I get an error message that my class has no attribute. I feel it has to do something with editing in vizard because in other editors I don't think i … | |
I have a third party sending me some infomaion. They say to use php $_post to recieve the information as follows [CODE]<?php //include the database handling class include("mysqlclass.php"); //Assign POSTED variables $destination = $_POST['gwNumber']; $originator = $_POST['originator']; $message = $_POST['message']; $smsTime = $_POST['smsTime']; $timeZone = $_POST['timeZone']; $network = $_POST['network']; $id … | |
Hello, I have been using the python challenge to teach myself python as my first programming/scripting language outside of HTML. As I go along, I find that while I'm understanding the concepts rather well, I am not being as efficient as I could be. While the code I whip up … | |
In my programming class, we need to write a program where the user is prompted for a value. Once that value is provided, the program is supposed to multiply its digits. For example: if the user typed 1234, it would multiply 1*2*3*4 and give the answer. I'm not sure how … | |
does anyone know how to shutdown a computer on windows XP (using python of course ;) given the IP address and the computer name (probably don't need it, though)? I don't want to use os commands like os.system("shutdown -i"). Thanks in advanced! | |
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 | |
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? … | |
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. | |
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. | |
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 | |
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 … | |
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 = … | |
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 … | |
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 = … | |
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: … | |
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 … | |
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? … | |
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? | |
[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 … | |
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 … |
The End.