988 Posted Topics

Member Avatar for giancan
Member Avatar for Slavi

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?

Member Avatar for Ene Uran
0
265
Member Avatar for Slavi

Interesting, do you think you need to use a 64bit version of Python because you have a 64bit computer?

Member Avatar for Ene Uran
0
182
Member Avatar for mark103
Member Avatar for Lardmeister

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 …

Member Avatar for vegaseat
1
298
Member Avatar for vegaseat

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 …

Member Avatar for HiHe
2
21K
Member Avatar for veledrom

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.

Member Avatar for Tcll
0
517
Member Avatar for debasisdas
Member Avatar for Ene Uran

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 …

Member Avatar for Lucaci Andrew
0
4K
Member Avatar for hariza

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 …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for Stefano Mtangoo

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 …

Member Avatar for vegaseat
0
985
Member Avatar for ~s.o.s~
Member Avatar for TrustyTony

Nice attempt, but I end up with (Python26): NameError: name 'calc' is not defined

Member Avatar for fonzali
1
2K
Member Avatar for chris99

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 …

Member Avatar for farmwife
0
6K
Member Avatar for steven woodman
Member Avatar for Ene Uran

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.

Member Avatar for james.lu.75491856
1
998
Member Avatar for jingda
Member Avatar for <M/>
0
430
Member Avatar for vegaseat

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'

Member Avatar for BearofNH
1
2K
Member Avatar for vegaseat

There is a limit to recursions in Python, find the limit with sys.getrecursionlimit() --> usually 1000 Can be changed with sys.setrecursionlimit(new_limit)

Member Avatar for sneekula
2
5K
Member Avatar for Ancient Dragon

Most IT departments won't let you cycle passwords. So I take my favorite word and mix it with numbers, like: **b1u2l3l4s5h6i7t**

Member Avatar for vegaseat
4
242
Member Avatar for aVar++

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.

Member Avatar for Ene Uran
0
289
Member Avatar for lancevo3

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) # …

Member Avatar for Ene Uran
0
1K
Member Avatar for scubastevie

So, what will this do? with open('numbers.txt') as f: for line in f: print(line, type(line))

Member Avatar for Lucaci Andrew
0
228
Member Avatar for gangster88
Member Avatar for jeremywduncan
Member Avatar for TrustyTony
-1
784
Member Avatar for jeremywduncan

The built-in Python functions sorted() and sort() are highly optimized and a good choice to use.

Member Avatar for jeremywduncan
0
830
Member Avatar for The Dude

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 …

Member Avatar for Ene Uran
9
4K
Member Avatar for MasterHacker110

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.

Member Avatar for Ene Uran
0
194
Member Avatar for vegaseat

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) # …

Member Avatar for Ene Uran
0
539
Member Avatar for SteveA

There is also a code snippet here at DaniWeb: http://www.daniweb.com/software-development/python/code/216538/removing-outdated-files-python

Member Avatar for Ene Uran
0
309
Member Avatar for LastMitch
Member Avatar for LastMitch
2
390
Member Avatar for sofien.fkih
Member Avatar for Lardmeister

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.

Member Avatar for vegaseat
0
192
Member Avatar for ndeniche

The Fiscal Cliff is solved. Or: There is a Santa Claus after all.

Member Avatar for chrishea
0
1K
Member Avatar for Lardmeister

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!"

Member Avatar for sneekula
2
2K
Member Avatar for <M/>

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.

Member Avatar for <M/>
0
389
Member Avatar for <M/>

The Alien from the Alien movie. Pops up when least expected, eats folks with those nasty titanium teeth, and sloppers slime all over.

Member Avatar for <M/>
0
215
Member Avatar for pmec

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

Member Avatar for ZZucker
0
5K
Member Avatar for bulleh

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 …

Member Avatar for bulleh
0
254
Member Avatar for saurabh.mehta.33234

// 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

Member Avatar for Gonbe
0
157
Member Avatar for BHARGAVI2

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) …

Member Avatar for Ene Uran
0
149
Member Avatar for pooja.singh.3950
Re: code

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 + …

Member Avatar for Ene Uran
-1
173
Member Avatar for wwielen

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()

Member Avatar for wwielen
0
141
Member Avatar for mgunia

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 …

Member Avatar for vegaseat
0
9K
Member Avatar for ImZick
Member Avatar for ImZick

I find video tutorials simply too distracting, usually put on by some ugly dude with poor pronunciation.

Member Avatar for TonyG_cyprus
0
179
Member Avatar for Ancient Dragon
Member Avatar for <M/>
0
126
Member Avatar for knd15

Oh my goodness, you are mixing a recursive fibonacci number function with an attempt to make a sliced list. A recipe for disaster.

Member Avatar for vegaseat
0
243
Member Avatar for Gribouillis

Line 9 `if isinstance(key, types.SliceType):` can be changed to `if isinstance(key, slice):` to work with Python27 and Python33

Member Avatar for Gribouillis
2
578
Member Avatar for nitin1

The End.