15,175 Topics

Member Avatar for
Member Avatar for sneek

Hi, I read that e.g. PyTupe_SetItem() steals a reference to the given object but I didn't get what that mean to me and why doesn't PyDict_SetItem() do it either? Jonny

Member Avatar for sneek
0
403
Member Avatar for TheManual

My connect4 game works fine, but after a user wins the program exits and prints a few tracebacks. Is it possible to not print any tracebacks and just exit a program smoothly?

Member Avatar for TheManual
0
198
Member Avatar for mahela007

I have some pretty basic questions about the different types of numbers in python (and other languages). What is the difference between an integer and a floating point number? I'd appreciate a detailed answer explaining some of the fundamentals.

Member Avatar for Gribouillis
0
155
Member Avatar for python.noob

Hai friends, I have a question which is very fundamental.. After installing boost python and bjam from ubuntu 9.04 repositories i can't find a clear detailed description about compiling and running the boost python program from it's tutorials .. Can any among you please tell me what are the options …

Member Avatar for python.noob
0
694
Member Avatar for Judgment

I require some help on how to go about writing a function that removes an item from a list along with how to return a list with an item removed. Any help would be gladly appreciated.

Member Avatar for snippsat
-2
111
Member Avatar for python user

I've been thinking recently about how cool it would be to make a rpg/text adventure game where you could fight monsters- in my case fallout3 inspired mutant hicks from the game point lookout. I have the room classes. (I can give code later in the day). how would i make …

Member Avatar for Mathhax0r
0
132
Member Avatar for nevets04

[CODE]import xchat hooker = None __module_name__ = "Away Script" __module_version__ = '1.0' __module_description__ = "States that your away" def away(word, word_eol, userdata): chan = xchat.get_info('channel') xchat.command("msg " + chan + " I'm Away") def toggle(word, word_eol, userdata): global a if word[1] == 'on': xchat.hook_print("Channel Msg Hilight", away) xchat.command("echo Loaded") elif …

Member Avatar for nevets04
0
76
Member Avatar for Mattokun99

Hi, Very new to Python and still stumbling around but need some help. As part of a larger script, I'd like to run a routine that checks for the existence of a file once a second for about 3 minutes and if it suddenly appears, carry on with the rest …

Member Avatar for Mattokun99
0
80
Member Avatar for sonial8

Hi I have a text file which has the following: 'username=sonia\n', 'password=password' I want to split sonia and place it in a variable called username. I was able to accomplish the following but could not remove the new line characters. text = 'username=sonia\n', 'password=password' text[0].split('=')[1] This returns 'sonia\n' So now …

Member Avatar for sonial8
-1
156
Member Avatar for olganneke

People, please help me! I must write 30 programs on python but not well understand this program. I don't know how to write 4 programs which are simple. [B]1)[/B] The polysemy of a word is the number of senses it has. Using WordNet, we can determine that the noun dog …

0
48
Member Avatar for Mouche

This is a split from another thread. I'm trying to think of a good way to simulate action other than just a hit/miss list. I want more complicated results andalso so that the character doesn't always die... Hmmm... okay. So I think I would do it like this: my_str = …

Member Avatar for python user
0
262
Member Avatar for vegaseat

Here is an example I was thinking of ... [code=python]import random import time def delay(seconds): time.sleep(seconds) def shuffle_hitlists(my_hitlist, mo_hitlist): """shuffle the two lists and return the result""" random.shuffle(my_hitlist) random.shuffle(mo_hitlist) return my_hitlist, mo_hitlist def battle(my_hitlist, mo_hitlist, my_strength, mo_strength): # player starts swinging first for k in range(len(my_hitlist)): my_hit = my_hitlist[k] mo_hit …

Member Avatar for python user
0
725
Member Avatar for k1w1dad

I have a script for renaming files, but can not seem to iron out the bugs. I am trying to rename a list of files: File1.File1 File2.File2 etc I need them to be renamed to: File1 File2 etc This is the code so far: [code] import os import sys import …

Member Avatar for Gribouillis
0
204
Member Avatar for v_rod

hi! i am making a prototype of an online stock trading application in python using tkinter module for Gui and a csv file for all the stock market data. i wish to know if there is an api using which stock prices can be changed if i keep all the …

Member Avatar for v_rod
1
114
Member Avatar for lukerobi

[code] class MyList(list): def __new__(cls, *p, **k): if not '_the_instance' in cls.__dict__: cls._the_instance = list.__new__(cls) return cls._the_instance def append(self, name): if name not in self: list.append(self, name) def extend(self, names): for name in names: if name in self: continue list.append(self, name) def remove(self, name): if name in self: list.remove(self, name) …

Member Avatar for Gribouillis
0
101
Member Avatar for Aiban

Hi Everyone. After many months my program works .. man, so much happiness, and it wasn't a small project, my first program is 400 lines of code LOL OK .. so i wanted to fix up some of the "prettines" and was looking for some ideas. One idea is this …

0
57
Member Avatar for ffs82defxp

First Program - CalcPro.py How do I make labels like in Batch so that I can 'go to' or initiate certain blocks of code when needed? And what is the command for goto? Whats the command for cls (or in other words clearing the screen)? [CODE]while 1: import math print …

Member Avatar for snippsat
0
118
Member Avatar for dmcadidas15

I'm trying to write a program that will open a file named "data.dat". This file contains an unknown number of values that I need to have read and averaged together and is written such that each line has one value. I need to have the data in this file be …

Member Avatar for pythopian
0
106
Member Avatar for dmcadidas15

Im trying to access a variable in a list that is 3 places earlier in the list. For example list_1[dogs, cats, pigs, hamsters, kids]. If Im trying to access the word cats based on the position of kids how would I do that? I know list_1[4] returns kids and I …

Member Avatar for dmcadidas15
0
87
Member Avatar for emir_gradacac

i followed official pygame tutorials, and stuck on the first one, the "introduction":$. there's a line 10 that goes : [CODE]ball = pygame.image.load("ball.bmp")[/CODE] and, since i don't have a "ball.bmp" in my computer, i decided to draw it in paint. now, when i write that line in the python interpreter, …

Member Avatar for python user
-1
208
Member Avatar for njam

i have the book for beginners python and pygame and i read through it and learn a lot but is there a place where they have more tutorials i just want to learn more and more about this cause i love making games. i have been to the website and …

0
50
Member Avatar for njam

hey guys I'm kine a new to pygame and i want to make a space game but i dont know how to make the screen folow my ship. if you have any info on this plz let me know. Thanks :)

Member Avatar for njam
0
70
Member Avatar for jorgejch

Hello, I've started with python (3) recently. Initialy only for scripting. Now I'm trying the object oriented bit. I'm getting the following error message [CODE] <Atom.Atom object at 0x7f0b09597fd0> Traceback (most recent call last): File "./Main.py", line 7, in <module> print (t.getAtomName()) File "/home/jorge/Documentos/projetos/mestrado/códigos/cartesian_zmatrix/Atom.py", line 22, in getAtomName return atomName …

Member Avatar for woooee
0
551
Member Avatar for mahela007
Member Avatar for ov3rcl0ck

I'm trying to strip HTML tags and replace certain tags with newlines and tabs. I just can't figure out a function to do this, any ideas? I'd prefer to use regex instead of a library.

Member Avatar for jlm699
0
105
Member Avatar for kleigh

Hey, guys! Newbie here. =) I'm trying to return an image that contains n^2 full size copies of my original image tiled, that makes an n-by-n square. I've been working on this for the past couple days and I am stuck. It's giving me an "image index out of range" …

Member Avatar for kleigh
0
3K
Member Avatar for scrace89

[CODE]area = ((length ** 2) * numSides) / (4 * (math.tan(FULL_ROTATION / (2 * numSides)\ )))[/CODE] this is my thought but I can't figure it out, I always get the wrong value. I need to get my answer in degrees. but even when i use [CODE]return math.degrees(area)[/CODE] at the end …

Member Avatar for vegaseat
0
119
Member Avatar for sentinel123

Hi Peepz, My Connect 4 board is made up of different lists. My task is to write a function that checks whether the game ends in a draw (that means when every spot is taken by a 'X' or an 'O' without fulfilling the winning requirements If everyspot is filled …

Member Avatar for masterofpuppets
0
133
Member Avatar for sanchitgarg

I want to check the input of the user. Only positive nos are allowed. I want to pass the input of the user to a function which checks that if it is i positive no. then it allows the user to continue further otherwise it gives an error and asks …

Member Avatar for sanchitgarg
0
82
Member Avatar for python user

[CODE=Python] def Myfunc(): print "Stuff" #Title: "CrashLanding" #By: Python User #November 16, 2009 #Features improved coding style, or at least I think so #note:code based on J.G.S'S code-I really learned alot from his code Some credit goes to him #note:I dont think that is his actual username so keep that …

Member Avatar for python user
0
214

The End.