15,175 Topics
| |
sorry for the noob question. i'm new to python. i'm trying to learn about classes and def. i created a simple one here called test2.py [CODE]class test: def Test1(T1): T1 = "this is a test"[/CODE] i have another python file, which is the main program called test1.py [CODE]from test2 import … | |
I tried executing a simple line drawing program using exec(). It worked fine. But when I tried to execute the same program by sending it through a tcp/ip network(the server reads the program and sends it to the client which receives it to a variable(b) of string type) and then … | |
hi .. im trying to terminate a process so in python i used os.system("taskkill /IM notepad.exe/T" and os.popen("taskkill /IM notepad.exe /f") neither have worked since the process does close but start up again !! on SOME computers it did work, the process was terminated but on others it did not … | |
hi all......... a1 a2 a3 a4 a5 a6 b1 b2 b3 b4 b5 b6 c1 c2 c3 c4 c5 c6 d1 d2 d3 d4 d5 d6 i want to select a column and i need a output like a1 a4 b1 b4 c1 c4 d1 d4 | |
hai friends i am 5 days old in learning python programming. I know perl for limited usage. I have a doubt regarding getting input in list during run time. is there any other way in python than typing like ["hi","hello"]. why it is not possible to insert value as we … | |
Hi, Is it possible to save the contents of a RichTextCtrl with the formatting? I'm writing a text editor to learn wxpython and when I use the SaveFile method it saves the data as plain text. PrintFile works the same. Doug | |
Hi everyone, I'm working on a website and need some help. I'm really not experienced with this stuff and I'm using wix with some borrowed html snippets. I wanted to use a vectorized image as a background that would scale to fit the browser on any screen as best as … | |
Hello: I am building a UI using Python in Maya, a 3D app. I have a panel in which I want to assign commands to buttons which are created in a loop. The commands have an arg, which is derived from the loop. Using lambda, the button commands all get … | |
I have a string as below [CODE]"i am genie. who are you? we worked together in a hotel called xsis."[/CODE] Normally string like the above is cleaned. Cleaning involves removing whitespaces. Thus the cleaned version of the above string would be [CODE]"iamgenie.whoareyou?weworkedtogetherinahotelcalledxsis."[/CODE] It is divided into kgrams of fixed size. … | |
hi i am a bit of a noob at python but am trying to make a desicsion making game (a bit like zork). i was wondering if anyone knew how i could get the palyer to go to a previouse part of the game without writing it all out again? … | |
While googleing for an answer I came across this thread... [url]http://www.daniweb.com/forums/thread55451.html[/url] ...which is pretty much my question, but I would be doing it in web directories. Would I need to connect with something like urlib2 and then try the os and glob examples. Maybe an example please? :D Thanks. | |
I have string like: 'par1=val1,par2=val2,par3="some text, again some text, again some text",par4="some text",par5=val5' I have to split it to parts like: par1=val1 par2=val2 par3="some text, again some text, again some text" par4="some text" par5=val5' I use this code: [CODE] a = 'par1=val1,par2=val2,par3="some text1, again some text2, again some text3",par4="some text",par5=val5'.split(',') … | |
Hi, this is my first post. I am making my first real text based adventure game in python and I've got an error: unbound method Main() must be called with Game instance as first argument (got nothing instead) But I am no where nere finsihed on the game as of … | |
im trying to create a program that reads a text file and plots the data using matplotlib. however, what i want to do is subdivide the each major y-axis display into 10 smaller segments. ive tried matplotlib.pyplot.yscale but i cant seem to quite get the hang of it. any help … | |
I was just playing around in python trying to get a basic sort of linked list working. I was able to make a simple linked list using an article I read online that looks like this: [CODE] class node: def __init__(self, value = None, next = None): self.value = value … | |
Hi, im quite new to python and I am trying to extract some data from a csv file and put it into a new file, this is the first line of the data: 1,3,0,1,2,2,1,13,19,30,13,10,20,+1 I have managed to get it to print a new line per column, but i need … | |
How can i get the content of a pop-up(that has no adress) from a specific website? | |
Hey guys, i have a problem with reading csv files. I have a csv file which i would like to read and save to a dictionary. Preview of the file: mpg;engine;horse;weight;accel;year;origin;cylinder 18;307;130;3504;12;70;1;8 15;350;165;3693;11,5;70;1;8 18;318;150;3436;11;70;1;8 16;304;150;3433;12;70;1;8 and so on.. The way that i would like it to save is basically for … | |
movies = [ "The Holy Grail", 1975, "Terry Jones & Terry Gilliam", 91, [INDENT]["Graham Chapman",[/INDENT] [INDENT][INDENT]["Michael Palin", "John Cleese", "Terry Gilliam", "Eric Idle", "Terry Jones"]]][/INDENT][/INDENT] print(movies[4][1][3] = Eric Idle Could Someone please explain how it counts from the outer loops through the inner loops With the number 4, 1, & … | |
Hi All, after almost a year, I'm back to Pythoning again! Now I want to setup my Ubuntu Box with LAMPP to work with Django. In PHP I just put my files in www folder and there it is! Please help me setup Django sites. Thanks and Happy new year … | |
Hi cannot get images to load any help would be gratefully recieved... [CODE] import pygame import sys from pygame.locals import * sys.path.append ("C:\\Python26\Bits\player.png") ###Will not Load saved image #triedC:\Python26\Bits\player.png # and tried C:\Python26\Bits #confusing or what!!! #Whole program not here # set up the window WINDOWWIDTH = 400 WINDOWHEIGHT = … | |
[CODE]from copy import deepcopy sis = file("teedtest.01.sis", "r") val = file("rp.val", "wt") N, K = map(int, sis.readline().strip().split()) alist = [] for i in range(0, K): t = [] for i in range(0, K): t.append(0) alist.append(t) for i in range(K): a, b, c = map(int, sis.readline().strip().split()) alist[a][b] = alist[b][a] = c … | |
Hi All, Been coding Python on and off for a year now, but only just started looking at wx. Got a problem in a larger project I'm working on, trying to remove all items from a GridSizer - I've created the following test code to demonstrate the problem, but to … | |
[B]Hi, Could someone tell me where to find a good tutorials on pygame 1.9.1 for beginner thanks[/B] | |
Hello, i have to split my code into parts so i split a dragimage demo from the wx demo package which is this code: [ICODE] import wx import images #---------------------------------------------------------------------- class DragShape: def __init__(self, bmp): self.bmp = bmp self.pos = (0,0) self.shown = True self.text = None self.fullscreen = False … | |
Hi, I'm new to programming, and I'm trying to make a simple metronome program. I can't figure out why sound is not being played. The tk window does open, but otherwise, nothing else happens. [CODE=python] from Tkinter import * import tkSnack root = Tk() tkSnack.initializeSnack(root) testsound = tkSnack.Sound(load='/Users/nikitahaduong/Desktop/Python/metronomesound.mp3') testsound.play() root.mainloop() … | |
In the following program, I'M getting the following result.Could somebody tell me why? >>> class obdi(object): ... def _new_(self,nm='hechao'): ... self.name=nm ... print 'Create a class instance for ',nm ... def showname(self): ... print 'your name is ',self.name ... print 'my name is ',self._class_._name_ ... >>> foo=obdi() >>> foo.showname() your … | |
[url]http://pastie.org/763792/wrap[/url] This in IMHO, a really useful piece of code, to wrap and run terminal commands, on a gtk+vte python based gui. I would to make some improvements, in order to wrap some terminal applications. How can SET_FOCUS (at start) to the first vte frame? (Avoiding to click on terminal … | |
hey, i am trying to create a progam that reads gif images and displays them from raw binary , but some how only small images worked till now [ICODE]from imagehex2 import* def lzw(hexList,asclist,numberbinary,numberbyte): lzw,x,numberbyte=[],0,numberbyte+1 number=numberbyte print number print 'numberc binary =',numberbinary numberbitperbinary=numberbinary+1 for t in range(len(hexList)): if asclist[t]==',': if hexList[t+5] … |
The End.