939 Posted Topics

Member Avatar for VernonDozier

If I google my real name pictures of nude women come up at the top (I think it's pinup or something).

Member Avatar for sneekula
2
485
Member Avatar for kiddo39

"YES" is not the same as "yes". To rectify, convert the input to lower case. Something like: [code=python] ans=raw_input("Are you feeling well today? ") if ans.lower() == "yes": print "That's good" else: print "Too bad" [/code]

Member Avatar for kiddo39
0
107
Member Avatar for faniryharijaona
Member Avatar for scru
0
92
Member Avatar for sneekula

One of the best nuggets of wisdom I ever got about using Ubuntu (and other Debian based systems) is learn to use apt. I suppose it applies to whatever package manager that your distribution happens to be using. Here's a quick run down on how I use apt. 1. Find …

Member Avatar for MaxVK
0
332
Member Avatar for serkan sendur

i am not racist or sexist anway. I thought most muslim people were.

Member Avatar for ~s.o.s~
0
318
Member Avatar for faniryharijaona
Member Avatar for txwooley

you almost had it: [code="python"] x = [5, 3, 7] x = x.sort() # or x.sorted() print x [/code]

Member Avatar for txwooley
0
84
Member Avatar for dliving
Member Avatar for Zanbi

The problem is that you denied IDLE the right to create a loopback server (which it needs; it doens't actually connect to the internet). You need to create an exception in your firewall that allows python to act as a server. You can google search on how to configure your …

Member Avatar for lllllIllIlllI
0
1K
Member Avatar for David.lewing

Python makes this sort of thing easy. [code="python"] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" keyword = raw_input().upper() # You may want to check that the keyword contains only letters from A-Z # if not keyword.isalpha(): # do something for letter in keyword: # remove keyword letters from alphabet alphabet = alphabet.replace(letter, "") d …

Member Avatar for woooee
0
373
Member Avatar for serkan sendur

[QUOTE=serkan sendur;854123]he is at your father's age, that is natural that he knows a lot.[/QUOTE] No. That would suggest that the older you are, the more you know, which is just not true. Case in point: you're older than I am.

Member Avatar for serkan sendur
-1
418
Member Avatar for danishbacker

What error are you receiving? Is it apache or IIS (don't know if this matters, but / works on my apache in windows). Does the snaps directory already exist? Because you might get an error (Permission Denied.) if it doesn't. Hope this helps.

Member Avatar for danishbacker
0
378
Member Avatar for daviddoria

you can try [code=python] mtrx = [[(0,0) for i in range(n)] for i in range(n)] [/code] Where n is the size of the matrix on both dimensions.

Member Avatar for vegaseat
0
103
Member Avatar for action_owl

Somebody should make a sticky thread titled "Can python do this?" with a single one-word post that reads: "Yes."

Member Avatar for vidaj
0
144
Member Avatar for NicAx64

[QUOTE=thoughtcoder;856577]You obviously have trouble understanding what I'm saying. I'm saying that your worldview (with your insane notion of "intellectual property") is wrong.[/QUOTE] But what if your worldview (with your [insane?] notion of universal freedom) is wrong instead? Point? You can't really tell someone that their world-view is "wrong". It can't …

Member Avatar for thoughtcoder
0
279
Member Avatar for lorayyne

This is a truly puzzling problem. Perhaps you'd like to attach your coinflip.py script? EDIT; The script in vegaseat's very last post works fine for me on python 2.6. Maybe your python installation is incorrectly configured, or...? EDIT 2: Having read you last post I went back and revised. I …

Member Avatar for targ
0
213
Member Avatar for Vihaio2012

you can do something like: [code=python] big_string = "" while not big_string.endswith("hth"): big_string += flip() flips = len(big_string) [/code] By find command I assume you mean find an occurence of a substring withing a string? Yes, just do [icode]s.find(sub, start, end)[/icode] where s is the string, and sub is the …

Member Avatar for scru
0
111
Member Avatar for besktrap
Member Avatar for jwatte

On line 22 you have the incorrect format string for the argument b. The format string should be [icode]"(O)"[/icode] as the argument is a Python object and not a null terminated wchar_t buffer. However, it seems that all you are trying to do is get a wchar_t buffer from the …

Member Avatar for jwatte
0
361
Member Avatar for Siaa

The basic algorithm I would use to start with goes something like this. As the code gets more mature I would look to refine and optimize it. [code] Loop through each pixel in the image: if the pixel's calculated luminance is more than a set constant: record pixel's location if …

Member Avatar for Nick Evan
0
117
Member Avatar for guano

QT (pyQT) can do svg files, I believe. Cairo (pyCairo) can also. The former is a GUI framework will the latter is a graphics library. EDIT: nevermind; I don't think QT can save svg files. I know cairo can render to pdf [B]and[/B] svg files though.

Member Avatar for scru
0
529
Member Avatar for mitchandsuzy

This is python; of course it's possible! Here's how to retrieve a function (and call it) from a module object. [code=python] # This example imports the 'os' module, tries to retrieve the function 'getcwd' and then calls it. import os func = getattr(os, 'getcwd', False) #Tries to get the attribute …

Member Avatar for mitchandsuzy
0
89
Member Avatar for ihatehippies

Do you mean you want a copy of the list, instead of the original? [code=python] o = r[:] [/code] Somehow I don't think that's what you mean though.

Member Avatar for ihatehippies
0
80
Member Avatar for Stefano Mtangoo

Sigh. This question has been asked and answered loads of times. But if you must. 1. Applications made by both have reasonably native appearances 2. I find them both around the same level of difficultly, but... 3. ...Qt has better documentation 4. That depends 5. Both have LGPL licenses, though …

Member Avatar for NicAx64
0
440
Member Avatar for daviddoria

The question for me is more of when [B]not[/B]. I tend to use other languages only when they make sense and then python for everything else (because of all of the ones I know it's the one I enjoy the most): C# for WPF Gui apps, C++ for speed critical …

Member Avatar for leegeorg07
0
136
Member Avatar for bhanu1225

I think you'd be better off finding out how native apps print on Mac OS X. I know Mac OS X uses CUPS, and I know it supposedly uses a server architecture, but that's about it.

Member Avatar for scru
0
127
Member Avatar for tivrfoa

You're using python 3.0. print is no longer a statement, but a function, so you have to use print("ok"). I suggest you do some research on how py3k is different from python 2x before you attempt to use it.

Member Avatar for tivrfoa
0
173
Member Avatar for max.yevs

Do you mean like: [code=python] import random def sample(items, amount): if amount > len(items): raise ValueError("Amount incorrect") r = set() while len(r) < amount: set.add(random.choice(items)) [/code] ? Not the most efficient algorithm, I admit, but it might just be the simplest. EDIT: I misinterpreted you. You need to express yourself …

Member Avatar for max.yevs
0
128
Member Avatar for txwooley
Member Avatar for txwooley
0
134
Member Avatar for jworld2

py2exe can package into a single file. You just have to tell it to. In your setup.py's setup function, adjust your options argument to include the following: [code=python] options = {"py2exe": {"compressed": 1, "optimize": 2, "ascii": 1, "bundle_files": 1}} [/code] I also noticed that I have [icode]zipfile=None[/icode] as an argument …

Member Avatar for jworld2
0
133
Member Avatar for leegeorg07
Re: 2to3

Another way is to add C:\Python30 (since you don't have Python 2.6) and C:\Python30\Tools\Scripts to your PATH variable. [URL="http://www.brightrev.com/how-to/windows/35-add-a-utilities-directory-to-your-pc.html?start=1"]http://www.brightrev.com/how-to/windows/35-add-a-utilities-directory-to-your-pc.html?start=1[/URL] Be careful because if you mess it up some programs may stop working.

Member Avatar for leegeorg07
0
197
Member Avatar for txwooley

The reason it's printing None is that you're not returning anything from the function. By using print on compare(), you're asking print to print whatever compare returns. compare returns nothing, hence it prints None. To get syntax coloring, change your start code tag to [code=python]

Member Avatar for txwooley
0
111
Member Avatar for docesam

You should also know that python has a powerful (though somewhat cumbersome) ctypes library that allows you to call C functions. This will handle your last request if you don't find a different built-in method of doing it (you may have to call the underlying platform's libraries to get the …

Member Avatar for Mearah
0
168
Member Avatar for katamole

I don't know how efficient that would be, especially for a large list. The in operator in this context basically loops through the sequence until it finds a match, returning false if it doesn't. The problem I have with its use in the above code is that it can be …

Member Avatar for woooee
0
181
Member Avatar for starzstar

Traditionally, options beginning with -- are commands and do require arguments. are you able to use -listContents or /listContents instead?

Member Avatar for adam1122
0
114
Member Avatar for alicem

If you use a library like PIL or pygame, you can pass that data to the library and let it handle to compression and saving for you. Just a thought.

Member Avatar for vegaseat
0
172
Member Avatar for harrykokil

[code=python] class StopWatch(object): def start(self): #code that starts def stop(self): #code that stops [/code] Can't give any more help than that without a better description of your problem.

Member Avatar for harrykokil
0
1K
Member Avatar for thehivetyrant

Now to the difference between for and while. while loops test a condition and execute the body as long as that condition is True. Normally, within the body of the while loop you would have to modify some variables to make the condition false eventually (in this case, you may …

Member Avatar for thehivetyrant
0
3K
Member Avatar for thehivetyrant

replace [icode]print i[/icode] with [icode]print "*" * i[/icode]. You may need to initialize i to 1 instead of 0. EDIT: Actually, that's the easy way out. The other way which might be the one your tutor is looking for (since this seems like homework) is to create another loop inside …

Member Avatar for thehivetyrant
0
103
Member Avatar for skhan23
Member Avatar for thehivetyrant

take the initializers and put them inside the function body, so that you have: [code=python] def sum(n): i = 0 total = 0 ...rest of your code starting with while statement [/code] Although, I have to ask, what is the purpose of this function? As it is, it will always …

Member Avatar for scru
0
92
Member Avatar for Rick3414

You can do fh.read().split(',') to split the line into a list of ['name', 'address', 'phone'] Python also has a [URL="http://docs.python.org/library/csv.html"]built-in csv module[/URL]. As to the code tags, you want to change the first one to [ code=python ]: leave the second one as is.

Member Avatar for vegaseat
0
118
Member Avatar for mg0959

For Windows, you may need to run the script in service space. Services are initialized once windows boots up and run until it shuts down. I don't know how you can run a python script as a service though, you can try bootstrapping.

Member Avatar for mg0959
0
160
Member Avatar for Hatz2619

First of all, you could get some better organization by using functions. Here's a structure I would find easy to work with: get_name() #Gets and returns the first and last name, validating them first get_hours() #Gets and returns the hours worked for the week, with validation get_wage() #Get and return …

Member Avatar for Hatz2619
0
925
Member Avatar for currupipi

Well xml files [B]are[/B] text files so yes you can do open() and read just as you normally would a text file.

Member Avatar for currupipi
0
118
Member Avatar for BlueNN

Just a correction to the first response: raw_input() is now input() for Python 3.0. You can put input() at the very end of your scripts if you are running them without IDLE (although I recommend IDLE for beginners) and it will wait until you press ENTER before exiting.

Member Avatar for BlueNN
0
145
Member Avatar for henryxxll

Tried the [URL="http://docs.python.org/library/subprocess.html"]subprocess[/URL] module? Try the call() function.

Member Avatar for henryxxll
0
3K
Member Avatar for tlinux

Also on windows, doing a "repair" in the control panel Add/remove programs on the version you want will set it as the default.

Member Avatar for scru
1
387
Member Avatar for pythonator
Member Avatar for Skimy
Member Avatar for chaney44145
0
116

The End.