988 Posted Topics

Member Avatar for Salem

A nano robot made to seek and destroy human sight and hearing sounds just a little too scary! Something the sickos in defense might just drool over.

Member Avatar for vegaseat
1
179
Member Avatar for funfullson

Simply loop your code a million times and time the whole thing. There is also module timeit.

Member Avatar for vegaseat
0
106
Member Avatar for PixelHead777

Calm down, nobody has called you anything! The thread caters to project ideas that are for the beginner. However beginners are at all sorts of levels in their learning progress. Any project takes some research, otherwise it isn't a project! I have enjoyed the sticky's project ideas very much. Please …

Member Avatar for Ene Uran
0
157
Member Avatar for Begjinner
Member Avatar for vegaseat
0
346
Member Avatar for calccrypto

When you use [B]Tm = [[0]*8]*24[/B] you are creating 24 alias copies of an eight zero list. That means all 24 sublists have the same memory address. To create the proper list of lists use this approach: [code]# create a 24 by 8 list of lists initialized with zero zerolist24x8 …

Member Avatar for calccrypto
0
68
Member Avatar for musthafa.aj

Here is a nice circular one: [QUOTE]Being a good leader, he then went to a phone booth, called the National Weather Service and asked, "Is this winter to be cold?" The man on the phone responded, "This winter is indeed going to be very cold." So the Chief went back …

Member Avatar for ankush.mukherje
1
108
Member Avatar for PetuniaRose

The US spends much more effort on destroying its leaders, than in creating solutions to our problems. It's so much easier to be a brainless loud mouth than a leader.

Member Avatar for Ene Uran
0
969
Member Avatar for A_Dubbs

You are getting into trouble with escaped characters caused by \ since '\r' is read as CR (carriage return). Try to use: [code] bright = wx.Image(r'C:\Users\Alexander\Desktop\New Folder\right.jpg', wx.BITMAP_TYPE_ANY) [/code]or: [code] bright = wx.Image('C:\\Users\\Alexander\\Desktop\\New Folder\\right.jpg', wx.BITMAP_TYPE_ANY) [/code] or: [code] bright = wx.Image('C:/Users/Alexander/Desktop/New Folder/right.jpg', wx.BITMAP_TYPE_ANY) [/code]for all your Window paths.

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

I understand it has been the Chinese government and their cronies (includes Baidu) that blatantly have been stealing Google technology that has Google upset!

Member Avatar for vaultdweller123
-1
146
Member Avatar for germ

[QUOTE=SgtMe;1106170]I don't know if this is what your looking for - i just did a quick google! [url]http://www.devshed.com/c/a/Python/Database-Programming-in-Python-Accessing-MySQL/[/url][/QUOTE]You can also use this: [url]http://www.lmgtfy.com/[/url]

Member Avatar for Ene Uran
0
96
Member Avatar for cwarn23

Big Bangs happen all the time. We are just too far way to observe them. I wonder what the opposite of a Big Bang is?

Member Avatar for Dope 7560
0
318
Member Avatar for senateboy

This would be a very basic pygame program, see if you can get that to work: [code=python]# fooling around with pygame --> draw/fill some rectangles import pygame as pg # initiate pygame first pg.init() #create a 400x300 window screen = pg.display.set_mode((400, 300)) # give it a title pg.display.set_caption('Draw/fill rectangles using …

Member Avatar for vegaseat
0
9K
Member Avatar for Ene Uran

I kind of like this little poem: [QUOTE][COLOR="DarkGreen"]The Spell Checker Poem ... Eye halve a spelling chequer It came with my pea sea It plainly marques four my revue Miss steaks eye kin knot sea. Eye strike a key and type a word And weight four it two say Weather …

Member Avatar for chickenfarmer
0
359
Member Avatar for sentinel123

Hint, generally you iterate over the string like this: [code]mystring = "abcdefghijklmnop" # newstring starts as an empty string (no char in it) newstring = "" count = 0 for c in mystring: # every third character is added to newstring if count % 3 == 0: #print( c ) …

Member Avatar for sentinel123
-2
4K
Member Avatar for hughv
Member Avatar for lrh9

Thanks for letting us know. I would have done it the same way too, since Frame has the convenient borderwidth arg.

Member Avatar for Ene Uran
0
12K
Member Avatar for tonywacu

We need a lot more information here. Also you have to come up with some pseudo code showing what you want to do and how you want tp proceed.

Member Avatar for Gribouillis
0
37
Member Avatar for jayjay85

There is some important information missing here. What module are you using/importing? Also I have a dislike for people who post two threads on the same subject. That is very rude. Which one of your threads are we supposed to help with?

Member Avatar for jayjay85
-1
136
Member Avatar for AutoPython

The only one that comes to mind is the Wing IDE from: [url]http://wingide.com/wingide[/url] There might be a trial version you can test drive.

Member Avatar for Gribouillis
0
174
Member Avatar for gangster88

This will give your program a certain eloquence: [code=python]# convert temperatures using Python2 or Python3 def f2c( fahrenheit ): """convert Fahrenheit to Celsius""" return ( fahrenheit - 32 ) * 5.0 / 9.0 def c2f( celsius ): """convert Celsius to Fahrenheit""" return 9.0 / 5.0 * celsius + 32 def …

Member Avatar for sneekula
0
596
Member Avatar for ffs82defxp

Just a general example of functions and their parameters/arguments: [code=python]# example of passing parameters/arguments to and from functions def get_data(): """get the data from the user, from a file, or hard coded""" mydata = [1, 2, 3, 4] # return requested data to caller return mydata def process_data(data=None): """this is …

Member Avatar for vegaseat
0
381
Member Avatar for MRWIGGLES

We just discussed that in detail, all you have to do is to slightly modify the solution: [code=python]# extract tag names in html code try: # Python2 import HTMLParser as hp except ImportError: # Python3 import html.parser as hp class MyHTMLParser(hp.HTMLParser): def __init__(self): hp.HTMLParser.__init__(self) self.tag_list = list() def handle_starttag(self, tag, …

Member Avatar for MRWIGGLES
0
95
Member Avatar for maomaohui
Member Avatar for Ene Uran
-2
75
Member Avatar for roshini.johri
Member Avatar for Ene Uran
0
134
Member Avatar for sknake
Member Avatar for mrnutty
Member Avatar for Ene Uran
4
113
Member Avatar for thesinik

Good show! So the question is, can you use your program to compute all the trig functions you wanted (sin, cos, tan, arcsin, etc.).

Member Avatar for thesinik
0
4K
Member Avatar for Yeen

Note that recursive functions have a lot of stack overhead and are slow. There is a limit to recursions: print( sys.getrecursionlimit() ) # --> usually 1000 default setting which can be changed to limit x with: sys.setrecursionlimit(x)

Member Avatar for Ene Uran
0
127
Member Avatar for Ene Uran
Member Avatar for vegaseat

Here is the code to sort a dictionary of dictionaries: [code]# sorted display of a dictionary of dictionaries def dict_of_dict_sort(dd, key): """ print out selected items from a dictionary of dictionaries dd sorted by a given key """ for k in sorted(dd, key=lambda x: dd[x][key]): print( k, dd[k]['age'], dd[k]['country'] ) …

Member Avatar for Ene Uran
2
375
Member Avatar for Dani

Well yeah, a very exuberant birthday to you! I am getting there too!

Member Avatar for AndreRet
1
430
Member Avatar for joshSCH

[QUOTE=joshSCH;805063]*TEST* *TEST* Has the KING truly been unbanned again? Muhahahaa.[/QUOTE]Let me guess, you must be from Texas?

Member Avatar for jbennet
-3
486
Member Avatar for sneekula
Member Avatar for zandiago
Member Avatar for Ene Uran

I have two similar lists and want to create a new list with just the differences between the two. Is there an existing function or do I have to iterate with a for loop?

Member Avatar for Gribouillis
0
2K
Member Avatar for FireSBurnsmuP

Here is a mildly more modern way: [code]// convert string to all lower case #include <algorithm> #include <cctype> #include <iostream> #include <string> using namespace std; int lower_case ( int c ) { return tolower ( c ); } int main() { string s = "THIS IS A TEST"; transform( s.begin(), …

Member Avatar for geinjo
0
2K
Member Avatar for sravan953

[QUOTE=sravan953;997726]I don't think getting the values will be a problem, because I've heard of GetValues() and Google it for help. The problem is: the [icode]self.panel[/icode] doesn't at all work... One more question: [code='python'] viewm=wx.Menu() viewm.Append(202,"About") self.Bind(wx.EVT_MENU,self.About,id=302) def About(self,event,id=302): about=wx.AboutDialogInfo() [/code] -but it doesn't work. How do I specify the ID …

Member Avatar for vegaseat
-1
3K
Member Avatar for neverlander

There is actually a python code snippet on animated gifs and wxpython: [url]http://www.daniweb.com/code/snippet435.html[/url] PyQT and QT use some rather complex legal stuff on licensing, so I don't use it!

Member Avatar for vegaseat
-1
5K
Member Avatar for kingofkya
Member Avatar for kingofkya
0
2K
Member Avatar for khaos64

You can concatenate tuples, the trick is to wrote the one element tuple correctly: [code=python]users = ('user1','user2','user3') # from input ... new_user = 'user4' # concatenate tuples, notice the way a one element tuple is written users = users + (new_user, ) print users # ('user1', 'user2', 'user3', 'user4') [/code]

Member Avatar for khaos64
0
273
Member Avatar for chico2009
Member Avatar for pysup

This problem has been around for a long time and not just with Python: [code=python]# the "Microsoft kludge", quoting a string within a string fixes the # space-in-folder-name problem, tells the OS to use the whole string # including spaces as a single command # (make sure filename does not …

Member Avatar for ov3rcl0ck
0
4K
Member Avatar for Joe Hart

See if something like this will do, but be careful that all the slicing doesn't steal some data: [code=python]def extract_number(data_str): """ extract the numeric value from a string (the string should contain only one numeric value) return the numeric part of the string or None """ s = "" for …

Member Avatar for Joe Hart
0
177
Member Avatar for alex-VX

Are you sure you posted in the right place? This is not the Mindreader Forum!

Member Avatar for alex-VX
0
298
Member Avatar for i are smart

[B]cTurtle.py has nothing to do with C.[/B] It is simply someones hack of the turtle.py with a few extra methods added. See the beginning of file cTurtle.py for details. You can also run it, as it has a built-in demo. It comes in two versions, one for Python2 and another …

Member Avatar for Ene Uran
0
215
Member Avatar for DEATHMASTER
Member Avatar for Triverske
Member Avatar for Stefano Mtangoo
0
108
Member Avatar for SuperMetroid

Also in Python3 'pg_r' would be a byte string and module re will complain without converting 'pg_r' to a string first.

Member Avatar for Ene Uran
0
138
Member Avatar for Felicidas

Give this a try: [code=python]import sys # there is a commandline if len(sys.argv) > 1: mylist = [] # sys.argv[0] is the program filename, slice it off for element in sys.argv[1:]: mylist.append(element) else: print "usage %s element1 element2 [element3 ...]" % sys.argv[0] sys.exit(1) # if the arguments were 1 2 …

Member Avatar for Felicidas
0
2K
Member Avatar for flebber

You can trap error details this way: [code=python]import datetime as dt def ObtainDate(): isValid=False while not isValid: userIn = raw_input("Type Date dd/mm/yy: ") try: # strptime throws an exception if the input doesn't match the pattern d1 = dt.datetime.strptime(userIn, "%d/%m/%y") isValid=True #Perhaps set another try here. print d1, type(d1) # …

Member Avatar for flebber
0
28K

The End.