988 Posted Topics
Re: 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. | |
Re: Simply loop your code a million times and time the whole thing. There is also module timeit. | |
Re: 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 … | |
Re: [QUOTE=Begjinner;1119650]This is the problem:[/QUOTE]So what is your code? | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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. | |
Re: I understand it has been the Chinese government and their cronies (includes Baidu) that blatantly have been stealing Google technology that has Google upset! | |
Re: [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] | |
Re: 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? | |
Re: 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 … | |
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 … | |
Re: 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 ) … | |
Re: Thanks for letting us know. I would have done it the same way too, since Frame has the convenient borderwidth arg. | |
Re: 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. | |
Re: 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? | |
Re: 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. | |
Re: 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 … | |
Re: 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 … | |
Re: 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, … | |
Re: Give your thread a meaningful title and more people will help. | |
Re: Maybe you should give your thread a more meaningful title. | |
Re: Please vote for jbennet, he is such a cute looking lad! | |
Re: Good show! So the question is, can you use your program to compute all the trig functions you wanted (sin, cos, tan, arcsin, etc.). | |
Re: 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) | |
| |
Re: 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'] ) … | |
| |
Re: [QUOTE=joshSCH;805063]*TEST* *TEST* Has the KING truly been unbanned again? Muhahahaa.[/QUOTE]Let me guess, you must be from Texas? | |
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? | |
Re: 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(), … | |
![]() | Re: [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 … |
Re: 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! | |
Re: Hint: Looks to me like you are creating the same label over and over again. | |
![]() | Re: 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] ![]() |
Re: Try something like: lineA = fin.readline()[lpa].strip() | |
Re: 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 … | |
Re: 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 … | |
Re: Are you sure you posted in the right place? This is not the Mindreader Forum! | |
Re: [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 … | |
![]() | |
Re: Pythons normally don't come with a handle, this must be a new breed. | |
Re: Also in Python3 'pg_r' would be a byte string and module re will complain without converting 'pg_r' to a string first. | |
Re: 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 … | |
Re: 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) # … |
The End.