15,181 Topics
| |
ok so every time i write this f=open('file.html') p=f.read() this come out and i do not understand it help!! p=f.read() File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 8171: ordinal not in range(128) i am trying to open a .html … | |
This app will execute and exit right after the process is complete. It will log different things using the logging module. For some reason everytime, no matter if the app execution is a success or a failure, it will tell me an error has occred, and see the log file … | |
Hi all, I was wondering if someone could help me with this bit of coding. I have set two veriables d1 and d2 to pick a random int of 1 to 10: which I need for in loop but when I run it the same number appear How do I … | |
Hey, I'm new to Python and wondering about the following bit of code. It tells me that the module random has no attribute randint. I've looked at the documentation and such and I think I'm doing it correctly, but obviously something's wrong. Any ideas? Thanks! [code] import random int1=random.randint(1, 6) … | |
Hi. I'm trying to make a function that takes nested tuples and returns a list of each nested tuple. I managed to make a function that returns the values of the tuples (which are strings), but cannot figure out how to retrieve the 'subtuples' in a list. Here's what I … | |
I have Python 2.7 installed, and I need to use matplotlib, but it is only available for Python 2.6. Is there any way to have 2.6 and 2.7 installed at the same time or is this asking for trouble? The reason I need matplotlib is I am trying to run … | |
[B][COLOR="Red"][B]Hi folk, I fairly new to Python 2.7 and Python 3 and like to find out how I would get a print to appear in the middle of the output screen without putting in a load of spaces into a print statement. Please keep it simple for me. Thanks for … | |
[B][COLOR="Red"]Hi all, Clould someone please tell how to use the sorted function or equivalent to this function in Python 3 so that I can sort a dictionary. I cannot find any help on this. Thanks for your time [/COLOR][/B] | |
Hi guys, I'm new to this forum and I have been studying Python for about 2 weeks. I know most of the beginners can solve all their doubts just by looking at the documentation, but even reading about these modules: time, datetime and threading, I wasn't able to solve one … | |
[CODE]sis = file("file.sis", "r") val = file("file.val", "wt") n = int(sis.readline().strip()) la = sis.readline().strip() alist = [] for i in xrange(n): line = sis.readline().strip() alist.append(line.split()) for i in xrange(n): print map(int, alist[i][0].split(":")), map(int, alist[i][1].split(":")) [/CODE] In: [CODE] 07:34 08:55 10 20 08:25 09:00 10 20 [/CODE] Out: [CODE] 08:25 09:00 … | |
Hi, I am trying to create some patterns in python. I am really struggling as to be quite fair, I don't have a clue what I am doing these are the 3 patterns I am trying to create. any help would be greatly appreciated thank you this is some code … | |
I need to open a webbrowser using python watch the email and password populate in the form, programmatically submit the form and keep the cookies while navigating through the web site. Any help would be greatly appreciated. | |
So i've been working on this code that i got online and it is a chat server code. This is the code- [CODE]# import needed modules: from socket import * # get sockets, for well, sockets import string # string functions import time # for sleep(1) function # define global … | |
Hey all, So basically I need to change the code so that the phonebook and the inverse phonebook are easily updated and maintained. Also, whenever I add an entry, both phonebooks need to be updated. Lastly, when I write a phonebook to a file, write a backwards phonebook as well. … | |
Guys I am trying to add an image to the window I created, but I get an error message when I run my code: [CODE]import wx class my_window(wx.Frame): app=wx.PySimpleApp() def __init__(self, parent, id): window = wx.Frame.__init__(self,parent,id,'Window', size=(600,400)) window.SetIcon(wx.Icon('porcupine.ico', wx.BITMAP_TYPE_ICO)) if __name__ == "__main__": frame=my_window(parent=None,id=-1) frame.Center() frame.Show() app.MainLoop()[/CODE] The message I … | |
Alright, so i got this question that im given a group of scores in the file, and i have to make them into a list, sort the list, and find the median. I got the sorting and the median done.. But I just got one problem that I can't seem … | |
so i know how to add the numbers in a list recursively [CODE] def ListSum(list): if list = []: return 0 else: return list[0] + ListSum(list[1:]) [/CODE] but how would i go about subtracting a list from a list using recursion? does anyone know how/ where i could go to … | |
I want to create a script that is constantly running in the background, searching for serial inputs. I have the background and serial input parts worked out. All I want to know is an effective way to constantly search for input, that does not bog down my CPU usage, or … | |
Hi im doing a basic script to parse a text file I want to look for a particular set of words. When i find the word then record the lines until there is a line that is blank [code=python] for line in logfile: for word in line.split(): if word in … | |
Hi, so I am trying to create a text file, that holds coordinates of bricks for the game brick breaker. I have a the textfile labeled as level1, and the coordinates are -5,9,0 -4,9,0 -3,9,0 now I am having trouble with getting python to open the file, and read the … | |
I can't get my game to work, I've been writing it out fo a couple days, worked at some points, but now isn't. I need to add the happyhouse and plane classes into the game, there are hashmarks letting you know what each is supposed to do. In general, kinda … | |
Okay, i've just started python a few days ago, and i think i'm doing well considering how quickly I"ve been working, but I've reached a dead end!! I keep encountering an error when using the statement "from sys import argv" In the first code were I had this problem, I … | |
I have a project to do and I'm pretty lost on it. The purpose of the project is to make a game like quoridor, but for this part you only need to have your program ready walls from a file (Walls are given in the format of: (startx, starty)(endx, endy) … | |
Hi guys i wonder if someone can help an absolute noob out with some homework. i was given a brief of: ask a user to input up to 3 mobile numbers. for the numbers entered display the list of numbers entered and clearly displays the mobile network each number belongs … | |
Hi. I'm trying to make a grade forecasting program for python 2.7. My problem is that I'm having difficulty trying to correlate the first "grade element" input with the first "grade element percentage" input. Here's what I have so far. ## Grade Forecast ## Chandiramani Grade Forecast [CODE]import random print … | |
Hello, can anyone help me on the fellowing... Write a function that will take two arguments: a word to be searched for and a list of strings containing the grid. The function should search for a horizontal left-to-right or vertical downwards occurrence of the word (e.g. activex and capslock in … | |
Guys, I just started tinkering with Python in a GUI enviorment. But I have a question. I a using wx-glade, and it says I can't touch the code between: [CODE]# begin wxGlade: extracode # end wxGlade[/CODE] Here is my code: [CODE]#!/usr/bin/env python # -*- coding: utf-8 -*- # generated by … | |
Im trying to make a card class that I can use in other programs, the main goal of this is to make a deck of cards that would be valid, only 52 cards - no repeats, 4 suits - 13 cards each. My problem is I don't know how to … | |
Hi, I am trying to make a brick breaker game, but I am stuck. i need help moving the panel, and getting the ball to bounce off of bricks upon collision and erase the bricks. Also I wanted to create two lists, one that contains coordinates, the second would be … | |
I am having some trouble verifying the given data for 'user' against what is already in the users.txt file. An example of a line in the text file is... ('Ralph', '1a1dc91c907325c69271ddf0c944bc72') Where 'Ralph' is what I want to compare against the users input for 'user'. Here is my code so … |
The End.