- Strength to Increase Rep
- +13
- Strength to Decrease Rep
- -3
- Upvotes Received
- 91
- Posts with Upvotes
- 82
- Upvoting Members
- 45
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
I love life.
- Interests
- Video Games, Movies, Drinking, Fishing, Hiking
- PC Specs
- 1. Windows XP SP2, Core2 Duo @ 2GHz, 2 GB 2. Ubuntu Hardy Heron, Pentium4 @ 2.3 GHz, 2.5 GB 3. Windows…
761 Posted Topics
Re: If you're using a tuple to keep track of what the user has already tried then you'll need to concatenate in the following manner: [code=python] >>> a = () >>> a += 'a' Traceback (most recent call last): File "<input>", line 1, in <module> TypeError: can only concatenate tuple (not … | |
Re: I did this and had a hell of a time figuring it out! Go to Run -> "Run...", then type in [icode]C:\PythonXX\pythonw.exe "$(FULL_CURRENT_PATH)"[/icode] ** Note I use pythonw.exe, you can just as easily use the standard python.exe (I just hate that console window), and when you've got that hit the … | |
Re: [QUOTE=funfullson;1104986]sorry.I saw links but i can not solve my problem yet. ... .but how can i do it?[/QUOTE] You should really follow those links that woooee provided. For this type of task you should be either using pexpect or subprocess PIPES, not [ICODE]os.system[/ICODE]. | |
Re: Here's a way: [code=python] shape = 0 while shape != 4: # Your existing code can go here [/code] Just slap that -blam- into a while loop and you've got a class 5 repeater. | |
Re: [QUOTE=mms6;1029512]anyone plz help me out here[/QUOTE] We're not here to do your homework for you. But good job on copy-pasting your assignment. [QUOTE=masterofpuppets;1029534]hi after reading the specification like 5 times here's what I came up with :)[/QUOTE] Dear MasterofPuppets, You shouldn't be spoon feeding people looking for us to do … | |
Re: Wow turtle is fun to play with :) [code=python] import turtle, time tp = turtle.Pen() tp.color('blue') for k in xrange(51): for j in xrange(k): tp.right(360/float(k)) tp.forward(25) time.sleep(3)[/code] *Oops I didn't mean to post this here, it was supposed to be in the thread asking about turtle *sorry* Editor's note: It's … | |
Re: [QUOTE=Ene Uran;871712]Beer was the national drink of ancient Egypt. The pharoahs even appointed a "royal chief beer inspector" to protect its quality. I don't think there is such a person in the US.[/QUOTE] Well each brewery does employ their own Brew Master that checks the brew on a daily basis, … | |
Re: As far as conversions are concerned there are a number of functions: [QUOTE]int(x [,base]) converts x to an integer long(x [,base]) converts x to a long integer float(x) converts x to a floating-point number complex(real [,imag]) creates a complex number chr(x) converts an integer to a character unichr(x) converts an … | |
Re: Gribouillis I'm not sure if this has been fixed or not (perhaps you're using a newer version of Python where this bug has been eliminated) but when I use your path.join this is what I get: [code=python] >>> from os.path import join as pjoin >>> pjoin("C:", "foo", "bar", "baz") 'C:foo\\bar\\baz' … | |
Re: [code=python] >>> answer =('7', 'Q', '5', 'H', '9', '4', '3', '8', 'L') >>> ''.join(answer) '7Q5H9438L' >>> [/code] | |
Re: Sometimes, if the module isn't in the same place, it is a matter of the path. At the begging of your progam you can do something like: [code=python] import sys sys.path.append('/path/tomy/module') from MyMod import moduleA [/code] However I don't know how Eclipse as an IDE differs in terms of working … | |
Re: If you search this forum for pygame you will find tons of examples of games that our forums members have creating using said module. Either that or google. | |
Re: It depends heavily on the format that you are receiving the time data in. Could you provide us with an example of EXACTLY what you are getting? If it is coming in as a string with the Time Zone then iyou simply use time.strptime(), which will make it very easy … | |
![]() | Re: I believe that [icode]subprocess.call[/icode] is used to open a file as if you had "dobule-clicked" the file's icon. If you're looking to do it "within" python you'll need to search this forum for how others have done it before you. |
Re: [QUOTE=tyincali;724172] (I think (I) (Might) ((See) A Problem) (Here) [/QUOTE] This is improper syntax, you're missing a closing parenthesis ;) No but seriously, to the OP: the error you are getting is trying to tell you that the image file that you're trying to open doesn't exist. You need to … | |
Re: I don't know if this module has been updated to support xlsx, but it provides a method to convert xls to xml: [URL="http://www.lexicon.net/sjmachin/xlrd.html"]xlrd[/URL] | |
Re: You're not multiplying by 2^16 and 2^8 you're shifting by 16 and 8 bits, respectively. By doing so (and then adding), you're able to fit the two letters into a single 16 bit block... or something like that. | |
Re: Greetings, welcome. Wondering what version of Python you're using and on which platform? First a tip: Don't EVER use tabs for Python indentation. It's pretty much standard practice to use 4 spaces instead. Most text editors can be set up to handle this. Here: Read over [URL="http://www.python.org/dev/peps/pep-0008/"]PEP 8[/URL], and then … | |
Re: An even easier workaround for being able to import modules from ANY directory is to modify the sys.path variable at run time. So at the beginning of your code do something like this: [code=python] import os,sys sys.path.append('/path/to_my/module') import my_custom_module [/code] And if you're working with a hard-coded windows path make … | |
Re: Please use code tags so that your indentation is not lost, and so that we may better read your posts. Code tags go like this: [noparse][code=python] # MY code goes between these tags! [/code][/noparse] | |
Re: [QUOTE=vegaseat;1038164]My advice, get rid of Vista as soon as you can.[/QUOTE] And if that's not an option make sure you're both installing and running all these things by right-clicking the executable and selecting "Run as Administrator" | |
Re: [QUOTE=mahela007;1041780]Is it possible to keep writing the output of a program on the same line instead of moving to a new line every time? The output should be written over the preceding output. An example would be a kind of counter... say a number that counts from 1 to 10 … | |
Re: Without using list comprehension: [code=python] f = open( "data.txt" ) lines = f.readlines() f.close() f = open( "data2.txt", 'w' ) for line in lines: line = line.strip() if line: f.write( "%s " % line ) f.write( "\n" ) f.close() [/code] | |
Re: I've used [URL="http://icofx.ro/"]IcoFX[/URL] in the past with no trouble | |
Re: It is impossible to answer your question without more information. If you are implementing a CGI HTTP server you should reference the following module, which may already provide some of the functions you're looking for: http://docs.python.org/library/cgihttpserver.html#module-CGIHTTPServer | |
Re: You could create your own class based on dictionary that checks whether that key already exists in `__setattr__` and then add the value to a list/tuple. When you do your `get()` you can then use `isinstance` to act accordingly. | |
Re: Use code tags: [noparse][code=python] #Code in here [/code][/noparse] This will make your code readable for us forum members, which in turn helps us to solve your problem. In order to limit the number of guesses, you should be using an [icode]if guesses == allowed_guesses:[/icode] statement, or something similar. | |
Re: Can you try just [icode]import myfile[/icode], without the .pyd? | |
![]() | Re: [QUOTE=leegeorg07;903214]Hi, me again, sorry if this sounds completely noobish but I have no idea what to do, even with shadwickman's help could anyone help?[/QUOTE] You have no idea what to do with regards to what? You don't know how to download the files? Browse the source tree? What? |
Re: [QUOTE=sneekula;862497]It's time again to poll the well educated folks at DaniWeb about the possible cause of the end of humanity on earth.[/QUOTE] I foresee an unavoidable uprising of our machines against us. Machines kill people at alarming rates, and we only keep trying to make them better and smarter... more … | |
Re: [QUOTE=ihatehippies;847706]How do you keep a wx frame from not responding while the code is running in the background? ie a search or other demanding function.[/QUOTE] You can use a busy cursor so that the user can't click on anything within the application: [code=python] wx.BeginBusyCursor() # Do all the stuff here … | |
Re: What Platform are you on? If this is linux you'll likely need to install tcl/tk to enable the Tk support portion of OpenGL | |
Re: Fight Club [QUOTE=Tyler Durden]F*ck redemption. We are God's unwanted children? So be it! ... You're not your job. You're not how much money you have in the bank. You're not the car you drive. You're not the contents of your wallet. You're not your f*cking khakis... You are not special. … | |
Re: You should uncomment your [icode]commit[/icode] statement. You need to commit your transactions before they go through. | |
Re: In the top-most bar (with the <DANIWEB> logo) select Control Panel -> Edit Options. On that page look for Messaging & Notification section (should be second gray section) [B][U]Uncheck[/U][/B] the boxes that read "[COLOR="Red"]Receive Occassional Email from DaniWeb[/COLOR]" and "[COLOR="Red"]Receive Email from Other Members[/COLOR]". Finally, on the drop down for … | |
Re: If the script has access to the URL you could do something like: [code=python] >>> url_in = 'http://host.com/script/2008/05/05' >>> match_text = 'script/' >>> index = url_in.find(match_text) + len(match_text) >>> url_in[index:].split('/') ['2008', '05', '05'] >>> [/code] Is that kind of what you were looking for? | |
Re: Usually it's as simple as [icode]python myscript.py[/icode] If python isn't in the path you'd need the full path to the python executable. | |
Please pardon my lack of networking knowledge. I am trying to figure out how to setup routing tables to connect to machines that are on a subnet on a different network. My current machine is sitting on a network, we'll call it Net1: My IP is 10.44.76.X (subnet 255.255.254.0 - … | |
Re: Go through the input file line by line writing to an output file - using either regular expression or a simple [icode]if 'dtp' in line:[/icode] expression, which when true skips writing the line to the output file. | |
| |
Re: [QUOTE=zachabesh;939198]the interactive shell (a la IDLE) is pretty darn awesome for testing stuff out. [/QUOTE] Agreed. I use Notepad++ for my editing and have it set up with all kinds of whiz-bangs. I hit F6 to pull up an instance of PyCrust which is a Python Shell with autocomplete, syntax … | |
Re: Here's a start: [url=http://www.google.com/search?hl=en&q=python+menu&btnG=Google+Search&aq=f&oq=]Google It[/url] | |
Re: [QUOTE=mahela007;1041779]is it possible, for example, to make the text that appears as output on the command line appear in a certain colour using python?[/QUOTE] Yes. But the answer depends on your platform. In windows you can use the command-line [ICODE]COLOR[/ICODE] command. Here's how: [code=console] Microsoft Windows XP [Version 5.1.2600] (C) … | |
Re: Use the [ICODE]button_object.config(text=my_text)[/ICODE] option. [URL="http://effbot.org/tkinterbook/button.htm#Tkinter.Button.config-method"]Source[/URL] | |
Re: I'm sorry to hear that you have to work with Jython. My condolences. That being said, why don't you insert a [icode]print type(strTest)[/icode] to see if it's actually being presented as a string. | |
Re: It would help to know what GUI toolkit you're working with; however a good method (in wx) would be to specify the ID of the window, and then check to see if that ID is already being used or not as the basis of opening the window. | |
Re: [QUOTE=rwbarrette;1107124]I can't seem to work out the scope of the variables so that they can be seen in the drawline function[/QUOTE] The things in drawline that are referenced as being members of self are defined in __init__ without being a member of anything (ie they are objects that are created … | |
Re: [QUOTE=germ;1105936]Does anyone have information that will sharpen my python programming knowledge very quickly with some get straight to the point programming tutorials and information?[/QUOTE] I suggest reading the book entitled Dive into Python, available for free [URL="http://diveintopython.org/"]here[/URL] EDIT: Also, it would benefit you to make use of the search capability … | |
Re: [QUOTE=J_IV;1104776]Looks fine to me. Can anyone tell what the problem is?[/QUOTE] You never defined [icode]t[/icode] | |
Re: Are you asking if your program will work in Unix, or are you literally asking how to transfer a file from one computer to another? |
The End.