988 Posted Topics
Re: Are your indentations a mixture of tabs and spaces? | |
Re: The first thing I do with editors on Windows is to set new lines to Linux Style. Wonder if there is a way to do this within Python code? | |
Re: Interesting, do you think you need to use a 64bit version of Python because you have a 64bit computer? | |
Re: Try self.program_buttons | |
Re: I am with you there, love Irish stew made from browned lamb, potatoes, onions, a shot of whisky, some parsley and spices! mmmmmm! Goes well with a glass of Guinness stout with a nice thick creamy head. Of course on St. Patricks Day it has to be green beer and … | |
Re: Here is a templet file that allows you to package your wxPython program to an executable file with the py2exe module. It contains an XML manifest that gives the wxPython widgets a Windows XP appearance on XP machines: [code=python]# Py2Exe version 6.6 setup file for wxPython GUI programs. # Creates … | |
Re: The Designer form builder that is installed with PyQT is probably the closest thing to Visual Studio. Too bad that BOA is stuck with wxPython and is at this time not available for Python3 development. | |
Most commonly a dictionary of key:value pairs is searched by the unique key. Sometimes it becomes necessary to search for the key, or keys given a value. Special consideration has to be given to this case, because the value does not have to be unique and may return several keys … | |
Re: If you use C++, load a string vector and use the vector's sort. Then you don't have to give a rat-poop about the sorting algorithm, it will be the best! A somewhat modern example: [code]// load a string vector with words from a whitespace // separated text file and sort … | |
Re: Like I mentioned in another thread, the problem is that a lot of those modules are freeware done by different folks. Monetary reward is more of a driving force, and it will take a while to get those free things to show up. Python30 has a lot of rather subtle … | |
Re: How to you handle tabs? | |
Re: Nice attempt, but I end up with (Python26): NameError: name 'calc' is not defined | |
Re: Oh, one of Vegaseat's brain teasers. There are several ways to solve this. If you look in the Python reference manual under sort for lists, you find that you can specify your own custom sort method. In this case it would be sorting by length of each word/string in the … | |
| |
More or less a templet database that allows you to load, save, add, list, search, edit and delete data items. I used movies as an example, but you can easily change that to make a database of many other things. | |
| |
Re: However, print float('0x123abc') does not work So maybe this would be better: def is_float(s): try: float(s) return True except: return False for s in ['1e3', '+3.14', '-77', '0x123abc']: if is_float(s): print float(s) else: print s + ' value gives float() error' | |
Re: There is a limit to recursions in Python, find the limit with sys.getrecursionlimit() --> usually 1000 Can be changed with sys.setrecursionlimit(new_limit) | |
Re: Most IT departments won't let you cycle passwords. So I take my favorite word and mix it with numbers, like: **b1u2l3l4s5h6i7t** | |
Re: Andreas, in any forum you will have people that don't know how to ask a proper question. I share with you the destain of folks that make their problem a guessing game for the helpers, slowly revealing what they actually want. | |
Re: After the help Gribouillis gave you, also run a test: class A(object): def __init__(self): self.a = 4 self.b = 6 class B(A): def __init__(self): A.__init__(self) #some code def action(self): self.a = 9 # test it aa = A() print(aa.a) # 4 bb = B() print(bb.a) # 4 bb.action() print(bb.a) # … | |
Re: So, what will this do? with open('numbers.txt') as f: for line in f: print(line, type(line)) | |
Re: I think you made a very good effort! But you need to let folks know what you are after. | |
Re: The built-in Python functions sorted() and sort() are highly optimized and a good choice to use. | |
Re: Very funny Snee! You might have to explain to our friends from India that Indians over here are native Americans, at least the few that are left over. Now I have to come up with something funny, a little dated, but here it is: Q: What's the difference between Monica … | |
Re: Stacks are used in assembly language a lot to store data. Python is a much higher language and stacks are rather transparent in use. Python has a module called deque (double_ended_que) with methods appendleft() and popleft() which behave like the push and pop of a stack. | |
Re: I took the liberty to update the code to work with Python27 and Python32 using the utility at "C:/Python32/Tools/Scripts/2to3.py" Here is the result: # remove all jpeg image files of an expired modification date = mtime # you could also use creation date (ctime) or last access date (atime) # … | |
Re: There is also a code snippet here at DaniWeb: http://www.daniweb.com/software-development/python/code/216538/removing-outdated-files-python | |
![]() | |
Re: Actually, once you get past the beer sold by the big makers, the best beers in the US are made by the many local Microbreweries. | |
Re: The Fiscal Cliff is solved. Or: There is a Santa Claus after all. | |
Re: End of the world: "Where is the Antichrist in all of this?" Logo: "Well, it's different! Sort a like cat poop on a fancy meal!" | |
Re: Evolutionists: An almost chicken laid the egg the first real chicken came out off. Creationists: God made the chicken and then it laid an egg. | |
Re: The Alien from the Alien movie. Pops up when least expected, eats folks with those nasty titanium teeth, and sloppers slime all over. | |
Re: The average would be (lap1 + lap2)/2 you would have to add the lap times as milliseconds then take the result and recreate the minutes:seconds:milliseconds format | |
Re: If you have the Windows OS, maybe you should look into Portable Python and run your code from a USB flashcard, and also use the PyScripter IDE that comes with it. For the free download and info see: http://www.portablepython.com/releases/ Since you are a beginner I would download Python version 2.7.3 … | |
Re: // show "How are you %dad%" #include <stdio.h> int main() { printf( "How are you %cdad%c", '%', '%'); getchar(); // wait return 0; } See http://ideone.com/wXgb0D | |
Re: C is great for low level coding. You are talking about a high level task and could switch to a higher level language to make your life more productive. ''' ps_image_viewer101.py view an image with Python using the PySide GUI toolkit PySide is the official LGPL-licensed version of PyQT (QT) … | |
Re: Try something like that: // power series dev using a loop // value of e = 2.71828182846 #include <stdio.h> int main() { int n, f; float x; float e; x = 1.0; f = 1; e = 0.0; //e = 1+x/1!+x2/2!+x3/3!+x4/4! ... //e = 1 + x * x*2.0/2 + … | |
Re: Try this: # wx.Slider(parent, id, value, minValue, maxValue, pos, size, style) import wx class freem(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self, parent, id, size=(300,100)) panel = wx.Panel(self) slider = wx.Slider(panel, -1, 50, 1, 100, pos=(10,10), size=(250,-1), style=wx.SL_AUTOTICKS | wx.SL_LABELS) slider.SetTickFreq(5) if __name__=='__main__': app = wx.App() frame = freem(parent=None, id=-1) frame.Show() app.MainLoop() | |
Re: This may give you a few hints: ''' csv_rread102.py find duplicate email addresses in a csv file ''' # csv type test data # name, surname, job_title, company, email csv_data = '''\ Arden,Adam,clerk,ACME Tools,aaden@gmail.com Bison,Bert,manager,Ideal Plumbing,bertbison@idel.com Clark,Clara,assistant,ACME Tools,clarkc@gmail.com Arden,Adam,supervisor,ACME Tools,aaden@gmail.com Clark,Clara,receptionist,ACME Homes,clarkc@gmail.com ''' import csv fname = "aaa_test7.csv" # write … | |
Re: Putting up with relatives and missing my friends. | |
Re: I find video tutorials simply too distracting, usually put on by some ugly dude with poor pronunciation. | |
Re: SWYFDST = Seniors watching young folks doing stupid things | |
![]() | Re: Oh my goodness, you are mixing a recursive fibonacci number function with an attempt to make a sliced list. A recipe for disaster. |
Re: Line 9 `if isinstance(key, types.SliceType):` can be changed to `if isinstance(key, slice):` to work with Python27 and Python33 | |
|
The End.