15,181 Topics
| |
Hello, I'm trying to deal a bit with IRC and Python 3. The decoding from bytes to Unicode create quite a dilemma. 1. Somehow it works to convert the å character from utf-8 to bytes, but the received bytes seem to often be encoded in latin-1, or at least they … | |
Okay, so I have a tuple for a game, and this is it: [icode]['Hondros', {'Equiped': [['none', [], 0], ['Rags', [0, 1, 0, 0], 1, 1], ['Mocassins', [0, 0, 1, 0], 1, 1], ['Gauntlets', [0, 0, 0, 1], 6, 5]], 'Equipment': [0, 1, 1, 1], 'Stats': {'AC': 14, 'Strength': 15, 'Constitution': … | |
Im trying to write a code for a colour picker, so a user can pick 4 different colours and then it would return them so i can use them in a different par tof the program, but its not working properly and i can work out why. any ideas? [CODE]def … | |
In the program below, I have two questions. First, the first object, card1 passes the strings A & c to it's master class. What I want to know is, what do these two strings have to do with the A & c in RANKS & SUITS? If the class had … | |
I'm thinking about writing a small command line directory management program in Python. The most basic functionality I want is to be able to compare the the files in a directory and sub-directory, and if there are any duplicates then delete the lower most duplicate. I all ready have a … | |
lets say i want to make a function that accepts a single argument that is supposed to be a number. lets say the function displays the range between 0 and the argument. Normally I'd do something like this: [CODE] def range_display(integer): set = [] for num in range(0, integer): range_list … | |
I use [url=http://www.en.wampserver.com/]WAMP[/url] to develop my PHP/MySQL applications locally before moving them to a production server. I want to start teaching myself Python and wish to add Python to my installation. I have downloaded and installed Python 2.5 and also installed mod_python. Unfortunately getting Apache to recognize that Python is … | |
I made this code: [CODE]import random wish = "j" max_multiplications = 10 while wish == "j": multi = 0 right_answer = 0 while max_multiplications != multi: randomint1 = random.randint(1, 10) randomint2 = random.randint(1, 10) print randomint1, "*", randomint2, "=" ik = float(raw_input ("Insert your answer ")) multi += 1 answer … | |
I have been teaching myself python for several months and have started working on an rpg project. Right now I am trying to code an armor class for a basic character. I am not sure if my approach is even a correct way to go about implementing this class. The … | |
hi , I have my python code but I couldn't solve it. here my sample loop: [CODE= python]import os import sys whileloop = True while(whileloop): initial_drive = "C:\\" inputline = input(initial_drive) <<< PROBLEM... if inputline == "exit": whileloop = False elif inputline == "about": print("no input") elif inputline == "": … | |
Can you please tell me why i can't run this sample test program?? [CODE]from PyQt4 import QtGui class testui(QtGui.QTabWidget): def __init__(self,parent=None): QtGui.QTabWidget.__init__(self) def test(self): QtGui.QMessageBox.warning(self,"Hello","This is a test message") def frun(objec): time.sleep(8) print('hello') objec.test() app=QtGui.QApplication(sys.argv) obj=testui() obj.show() threading.Thread(target=frun,args=(obj,)).start() app.exec_()[/CODE] But in real i want to receive messages from the threads … | |
I have written code to use the automatic CD-Burn routine inside WinXP and above. But I cannot start the CD Writing Wizard by python code. Has anybody any idea how to do it? This is my code so far: [CODE]#!/usr/bin/env python # -*- coding: utf-8 -*- import os, sys import … | |
Okay, I am in the middle of creating a rather large console RPG. It'll include ability to equip armor, weapons, interacting with NPC's, battles, saving/loading characters, etc. I don't want to save all of my classes and functions in the same file, for easier readability. I have a few questions: … | |
Hi everyone. I'm new to Python and programming in general. I'm currently reading [URL="http://www.dickbaldwin.com/tocpyth.htm"]this[/URL] tutorial. In the scripts section he mentions "setting the path" and that it needs to be done in order for scripts to work. How do I set the path in Windows XP? Thanks! | |
This code is IronPython! Won't work with CPython. IronPython - Hello World [CODE] import clr clr.AddReference('System.Windows.Forms') from System.Windows.Forms import Application, Form, Label form = Form(Text="Hello World Form") label = Label(Text="Hello World!") form.Controls.Add(label) Application.Run(form) [/CODE] Editor's note: This post moved from Python GUI Programming sticky thread. Please follow the rules of … | |
I need to know more about turbogears as one tools used to develop web by python (rapid development ). if any person know more information about this topic | |
Hi there daniweb, im looking for some help. I have two classes MainWindow(wx.Frame), and AddTask(wx.Dialog). MainWindow contains a listbox called task_list. When AddTask is created I want the user to fill out the required info and and then click a button activating an on_click event. In that event I want … | |
Python uses the Mersenne Twister as the core random generator. The module random contains a fair number of methods (or functions) that help you to do random things. Here are some examples ... | |
>>> from os import * >>> a = [] >>> a = listdir('.') >>> f = open(a[0],'r') Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> f = open(a[0],'r') TypeError: an integer is required doesn't work, please help me | |
I'm working with Tkinter and I need to make 600 buttons in a grid of 6x100. Is there a way to produce generic variables by going through a for loop? Or do I have to type all 600? | |
If you are on school and you are taking algebra like me or just want to find the missing length of one side of the triangle than this program should help you out. Pythagorean Theorem Calculator is great and extremely essay to use thanks to this little program I pass … | |
need help correcting! first day,first 2 hours, first python program,(only had a little dark basic) [CODE]active="on" def ondamenu(): print "" print "enter integer 1 or 2" print "" print "opt.1 find the circumference" print "opt.2 find the radius" print "opt.3 quit calculator.py" print "" return input ("enter your choice: ") … | |
hi there got a couple of probs, say in my text file i have: abase abased abasement abasements abases -------- This coding below is meant to find a word in a file and print all the lines to the end of the file. But it doesnt, it only prints out … | |
Hi Gentlemen, I have an error, which was non existant when i used wxpython 2.8.7.1. When i upgraded to 2.8.10.1, basically the GUI got messed up.I am using Python 2.52 environment. The error seems to be from the fact that the parent, in this case MyFrame(wx.aui.AuiMDIParentFrame), is the default frame, … | |
hello, i am new to python and i want to do development in python now. my problem is that: tell me what should be install in the system to start python development? tell me which is the best editor that can help to edit and run python code efficiently? tell … | |
How can I write a definition for a function that is passed a list of numbers and returns the sum of the numbers in that list using a while loop? I'm trying this, but it's not working def sumList(): num = [1,2,3] sum = 0 while num != str: for … | |
Hello, I need help with editing this program: [code]#!/usr/bin/env python """ Monte Carlo simulation for the Monty Hall Problem: http://en.wikipedia.org/wiki/Monty_Hall_problem. """ import sys from random import randrange, shuffle, choice DOORS = ['car', 'goat', 'goat'] def pick_door(): """Return a number representing the player's first choice.""" return randrange(3) def reveal_door(pick): """Return the … | |
For my project I am coding battleship. I don't know how i should go about 1. mapping the board spots (dictionaries?) 2. randomizing ship placement any advice would be greatly appreciated PS. I am using pygame as well. | |
What is the difference between [CODE]file = open("name.txt")[/CODE] and [CODE]file = open("name.txt", 'r')[/CODE]? I can still use the methods: read(n), readline(n), and readlines(n) without adding the "r" in the open method. | |
Hello good day guys. I just want to ask for help in my java python. I am just new in this language. MY first java language is java. However, for me to make it easier to code in python, i need to code it in java first and then convert … |
The End.