226 Posted Topics

Member Avatar for ultimatebuster

You have to use some sort of web framework, Ruby by itself doesn't work on the web, so that's why there is Rails. Same thing with Python, you have to use something like Django, web2py, pylons, etc.

Member Avatar for snippsat
0
137
Member Avatar for JordanWalcaraz

[QUOTE=vegaseat;1190832]Actually Python2's input() used raw_input() and eval() to come up with a number, a dangerous combination. Now input() returns a string, and it is up to the user to convert it into the correct type.[/QUOTE] And BDFL didn't like it, so that's another reason why its changed :).

Member Avatar for hondros
0
142
Member Avatar for teg1989

I would say you have to get/make 6 images, something like this: [INDENT]dice-1.gif dice-2.gif dice-3.gif dice-4.gif dice-5.gif dice-6.gif[/INDENT] I would just download the images from the website you gave us. That would be the place to start.

Member Avatar for ~s.o.s~
0
2K
Member Avatar for Noliving

[QUOTE=Noliving;1188719]When eval an equation does it follow the PEMDAS rules? For example: 2.0-1.0-3.0*6.0+5.0*4.0 when evaluated equals 3.0 when evaluated by python. To me that doesn't seem correct, I get a much larger number than 3.0 When I evaluate in python eval("6/2*3") it should equal 1 but in python it equals …

Member Avatar for Tech B
1
211
Member Avatar for Hummdis

[QUOTE=Hummdis;1187347]The user did have to enter the 'admin' password in order to get to this page, [/QUOTE] How did that work?

Member Avatar for Hummdis
0
375
Member Avatar for adam321

Please use the code tag! - (can't interpret your code, when Python's blocks are defined by whitespace, but here they don't exist. imagine C, C++, C#, Java without brackets) class BeautifulIndent(object): @staticmethod def BeautifulIndentedMethod(): pass Your error is caused because int isn't iterable, so somewhere you have something like this: …

Member Avatar for jcao219
0
175
Member Avatar for srk619

Start with the basics, because muds get very complicated. You can't expect to make one without a lot of experience it a broad range of coding topics.

Member Avatar for ultimatebuster
0
799
Member Avatar for jcao219

I personally prefer the 3 syntax over 2, but I notice most of the code snippets in this forum are for Python 2. Is it because we are still in a steady transition from 2 to 3, or is it something else?

Member Avatar for hondros
0
209
Member Avatar for richardtreier

Well you can use many languages for autobot program creation. Python works, but I don't think it is the best way since you have to mess with Win32API and hooks. I think one of the best ways is to write an Autoit script.

Member Avatar for richardtreier
0
238
Member Avatar for Purnima12

[QUOTE=Purnima12;1188716] If the user inserts a number that is not 5 - 20, I want the program to shut down, this value error only restarts the program if the user enters a letter or symbol.... how can i fix this? thanks![/QUOTE] Like this? Although if the user inputs something like …

Member Avatar for TrustyTony
0
544
Member Avatar for jozz3

does it have to be recursive? something like this (I haven't tested this code, just typed it down really quickly) [CODE] def print_out_in(text): if len(text) % 2: end = ((len(text) - 1)/2) + 1 for x in range(1,end): print text[x] print text[(-1)*x] print text[end+1] else: end = len(text)/2 + 1 …

Member Avatar for jozz3
0
575
Member Avatar for ihatehippies

well looking at the cpp code behind wxpython's NullBitmap: [CODE=c++] //this code is from wxpython's //_gdi_wrap.cpp line 7026 to 7124 SWIGINTERN PyObject *_wrap_Bitmap_GetSubBitmap(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; wxBitmap *arg1 = (wxBitmap *) 0 ; wxRect *arg2 = 0 ; SwigValueWrapper<wxBitmap > result; void *argp1 …

Member Avatar for ihatehippies
0
225
Member Avatar for Hoban

range is only for integers. You should either use numpy: [CODE]import numpy numpy.arange(0,1,0.1)[/CODE] or you can do this: [icode][x * 0.1 for x in range(0, 10)][/icode] or you can do this: [code]def floatrange(start, stop, step): while start < stop: yield start start += step print ["%s" % x for x …

Member Avatar for vegaseat
0
114
Member Avatar for kjock002

[QUOTE=kjock002;1187316]the random function gives you a number between 0.0 and 1.0 . im trying to get a random number between -0.5 and 0.5. i asked someone for help and they told me to go off of this: [0, 1) + .1 this changes the range to [1, 2) and i …

Member Avatar for Gribouillis
0
101
Member Avatar for kjock002

This is what you need to add at the end of the [icode]while true[/icode]: [code] while True: #...OMITTED #this is what you can add to fix the problem if going.lower() == "n": break [/code]

Member Avatar for jcao219
0
116
Member Avatar for kjock002

Here's are the main problems in your code, explanations in comments. I fixed it so that it runs. [CODE]import random def randWalk(n): #n = raw_i... <- (Don't need that!) n = int(n) #Str to int conversion steps = 0 h = 0 t = 0 while (h + t ) …

Member Avatar for jcao219
0
182
Member Avatar for penguin22
Member Avatar for pareshverma91

Well Python is open-source, so you can always just look at its source. It's very advanced C coding and stuff, so I'm not sure why you are curious.

Member Avatar for scru
0
108
Member Avatar for peppermints

In my opinion, this is a better way to write fight(): [CODE] def fight(self): weapon = self.weapon.get() op = self.comp_choice() defeats = {"scissors":"paper", #scissors defeats paper "paper":"rock", #paper defeats rock "rock":"scissors"} #rock defeats scissors if not weapon: #if the user didn't select a radiobutton outcome = "Please choose a weapon!" …

Member Avatar for jcao219
0
714
Member Avatar for Enders_Game

After [icode]print(attrs[1][1])[/icode], maybe you can put a line [icode]self.reset()[/icode]? I am just guessing. I've never used HTMLParser before.

Member Avatar for Enders_Game
0
170
Member Avatar for Sauronevileye

I'm sure you can use os.walk and it yields a 3-tuple (dirpath, dirnames, filenames)

Member Avatar for Sauronevileye
0
164
Member Avatar for the_mia_team

Why do you have a "methods" method? It seems very weird to me. also it should be [icode]if __name__ == "__main__":[/icode] also, you have a "self" reference outside the class, which will raise a NameError. Keep working on your program.

Member Avatar for Mensa180
0
4K
Member Avatar for helios0684

Use the code tag so that your code can look like this: class StringBuffer: def write(self, input): s = input t = s if '*' in input: input += t # input = input.'do not print anything that comes after the *, but retain it) print input else: s += …

Member Avatar for helios0684
0
3K
Member Avatar for wtzolt

You are right, threads are the best way to go. Just google "python threading" and learn from there. I don't know anything about it, I always use the .NET version of threading.

Member Avatar for jcao219
0
142
Member Avatar for ultimatebuster

In a static language like C or Java, of course. But, doing exactly that in Python is impossible. The closest way is to do use the above solutions. Here's why... :) In Python, variables don't actually have a type. So that's why you can do this: [CODE] x = 1 …

Member Avatar for ultimatebuster
0
567
Member Avatar for leviaeon

[I]Use the code tag.[/I] You need to add this line in the beginning. [code]import sys[/code]

Member Avatar for leviaeon
-1
120
Member Avatar for jcao219

Most people would do something like this: [icode]input("Press any key to continue") #or raw_input[/icode] This way, if the user presses a key other than the Enter (return) key, then the program will still continue. It looks something like this: [URL="http://i42.tinypic.com/2yvp9hj.png"]http://i42.tinypic.com/2yvp9hj.png[/URL]

0
220
Member Avatar for Tops

[CODE] def remove_first_column(text): splitString = text.split('--') splitString.pop(0) finalString = " -- ".join( [item.strip() for item in splitString]) return finalString def main(): testString = """US --9--15--13--37 GE --10 --13--7--30 CA-- 14 -- 7 -- 5-- 26""" for line in testString.split("\n"): print(remove_first_column(line)) #py2.5 print remove_first_column(line) if __name__ == '__main__': main() [/CODE] Just …

Member Avatar for TrustyTony
0
2K
Member Avatar for thompsonSensibl

[QUOTE=megaflo;1183621]Why? Without knowing the OP use case there may or may not be a reason to store the numbers.[/QUOTE] No, Gribouillis's code is the most efficient. There probably is a need to store the numbers, since his original code was something like [code] firstNumber = int(array[0]) secondNumber = int(array[1]) thirdNumber …

Member Avatar for megaflo
0
8K
Member Avatar for wtzolt

I'm not sure, but I think you have to include these: cairo, pango, pangocairo, atk, gobject I was reading that from the code here: [CODE]http://www.py2exe.org/index.cgi/Py2exeAndPyGTK[/CODE]

Member Avatar for wtzolt
0
121
Member Avatar for jpob

[QUOTE=vegaseat;1182028]Take a look at the approach taken in: [url]http://www.daniweb.com/forums/post1122938.html#post1122938[/url] The word [B]the[/B] will give you a real problem since it can translate to [B]der, die or das[/B] If you use lower case only: the cat --> die katze the dog --> der hund the house --> das haus[/QUOTE] Also [B]den[/B]. …

Member Avatar for jpob
0
263
Member Avatar for dilbert_here00

It's even hard to do with Windows native API, and even harder with .NET. So I think it might be possible, but you would have to use lots of ctypes and win32api. I don't think it's worth a try.

Member Avatar for jcao219
0
91
Member Avatar for vsagarmb

[QUOTE=vsagarmb;1180309] I start the above thread in another objects constructor and i am trying to call the stopParser() method in the destructor. [/QUOTE] I'm not understanding you there. Why can't you call the stopParser method?

Member Avatar for jcao219
0
138
Member Avatar for nichedge
Member Avatar for nichedge
0
598
Member Avatar for ihatehippies

You can use decorators, or you can use metaclasses to decorate all the methods in a class. Then you can make the decorator modify each function on the fly.

Member Avatar for Gribouillis
0
370
Member Avatar for Ronnicus

[QUOTE=Ronnicus;1176433]Why is the test in the function local? I meant to have it change the one outside, how would I do so without returning the variable?[/QUOTE] You'd do [icode]global test[/icode], which is a bad idea, since it is evidence for bad code structure. Scopes make Python a clean and professional …

Member Avatar for bumsfeld
0
87
Member Avatar for ragavh

For such a task, the Python code is easy. The real challenge for you is to find a way to make some sort of English-Spanish dictionary. I would just use a translator tool like Google Translate, and use its API.

Member Avatar for jcao219
0
172
Member Avatar for yesha27

[QUOTE=vegaseat;1176872][B]Jython[/B] comes to mind. It would allow you to run Python code under Java.[/QUOTE] I was about to say that. Jython is Python for Java, so just download Netbeans and the latest version of Jython, and copy the file over and see if it compiles. I've never worked with Jython, …

Member Avatar for jcao219
0
185
Member Avatar for ultimatebuster

Well you use a web framework. Django is a good example; it is considered one of the best frameworks for web programming. You can do some research on that. Web2py is also great.

Member Avatar for snippsat
0
117
Member Avatar for SgtMe

[QUOTE=SgtMe;1172242]Nope. In your code, which I copied and pasted in, the line.rstrip("\n") bit was in there already. I use line.strip() but that didn't work...[/QUOTE] line.rstrip() doesn't do anything at all to line it returns a string that is the rstripped version. gotta remember that. use [B]line = [/B]line.rstrip()

Member Avatar for snippsat
0
16K
Member Avatar for pyprog

[QUOTE=pyprog;1172476][CODE]list1 = [[],[],[]] list2 = [[1,2,3],[4,5,6],[7,8,9]] i = 0 j = 0 k = 0 while i < len(list1): list1[i].append(list2[j][k]) i += 1 k += 1[/CODE] I want my output for list1 to be [[1,4,7],[2,5,8],[3,6,9]]. The problem is I don't know how to advance through the lists in list2. Can …

Member Avatar for arunbg
0
163
Member Avatar for brianlion1992

I'm not quite understanding the problem here, you have boyle's, charles's, and etc. calculators all written out but you want to combine them so that you can access then all from a single top menu?

Member Avatar for jcao219
0
130
Member Avatar for camigirl4k3

I guess you can add something like this: (not sure if you are using py2 or 3, this is 3) [CODE] Scores = [] while True: a = int(input("Enter score (0 to stop):")) if not a: break Scores.append(a) [/CODE] I think that should do it. Didn't test it.

Member Avatar for spiricn
1
250
Member Avatar for valter
Member Avatar for catcit

Good luck! OOP to GUI is a very broad range of topics. For OOP, I guess you can learn it from a tutorial, but practicing by writing code really helps to make you a better programmer. For GUI, just find a good toolkit, i.e. wxPython would be a good one. …

Member Avatar for jcao219
0
150
Member Avatar for goodwin912

VB.NET and IronPython can be easily converted to and from eachother because they both run on the CLI. You would use System.Windows.Forms for both in order to make gui, for example. I don't know about just VB.

Member Avatar for goodwin912
0
155
Member Avatar for davethebear10

At the for loop, you need to add a [icode]userid = ""[/icode] or a [icode]del userid[/icode] I would do it right after line 8 of your code.

Member Avatar for woooee
0
253
Member Avatar for tkpanther

If Python is freezing, I suggest you use threading to put the busy work of the program in another thread. Once you solve the freezing problem with threading, I'm sure you can solve the rest.

Member Avatar for ssmokincamaro
0
194
Member Avatar for bumsfeld

Get SharpDevelop ([URL="http://sharpdevelop.net/"]http://sharpdevelop.net/[/URL]) It'll do that for you. IronPython supports System.Reflection.Emit, and SharpDevelop uses that to create an executable. Of course, you can also use the pyc.py tool included with ipy, but I prefer SharpDevelop. I'm so glad I'm not the only one who uses IronPython. It's awesome isn't it.

Member Avatar for jcao219
0
187
Member Avatar for jake2891

Try using SendDlgItemMessage [URL="http://msdn.microsoft.com/en-us/library/ms645515(VS.85).aspx"]http://msdn.microsoft.com/en-us/library/ms645515(VS.85).aspx[/URL]

Member Avatar for jcao219
0
169

The End.