153 Posted Topics
Re: hit the (CODE) button/tags before you post code, also your strategy for the key is awful...I don't understand why you would do:d=len(phbuk);phbuk[d+1]=name How about something more like: `phbuk[a]=abc #"or [b,c] depending on your preference"#` > Now if i want to delete a particular record just by giving name then how … | |
Re: Here's a little help to get the juices flowing, but for the future you need to show effort around here [B][U]take heed of Ezzaral's edit notes[/U][/B] and read that thread, or for a quicker review of what he's talking about read [U][URL="http://www.daniweb.com/software-development/python/threads/359823"]pytony's signature[/URL][/U][CODE]def mult_table_numbers(): alpha = int(input('Starting: ')) omega = … | |
Re: You can't just drop off your homework assignment and expect us to do it for you, put some effort in and we'll help you figure out issues. | |
Re: Tcll, as you should know people are much less likely to reply to "solved" threads, we also don't like old ones bumped up, just start a new thread. | |
Re: Python comes with an IDE called IDLE; I'd suggest reading the beginner threads and also decide which version of python you're going to start with, python 3.2.2 is the most recent version, there are more packages available for python 2.7 but the future is python 3; python 3 is backwards-incompatible … | |
Re: You were thinking in the right direction, you just weren't actually doing anything: I'll give you heavy help on one of them and the idea should become quite clear for all of them. [CODE]>>> word=input('word: ') word: hello >>> word3='' >>> for letter in word[::-1]: #which could also be "for … | |
Re: :) well just so ya know there is a random module with things like shuffle.[CODE]import random f=open('names.txt','r') names=f.readlines() f.close() selected_names=set() while len(selected_names)<5: random.shuffle(names) indx=random.randint(0,len(names)-1) selected_names.add(names[indx])[/CODE] a set will get rid of any duplicates. but you could also do a "if key not in list" kind of thing:[CODE]selected_names=[] while len(selected_names)<5: random.shuffle(names) … | |
Just fooling around I came across an issue updating a digital-clock like label. This: [CODE]self.now=time.strftime('%a. %b %d %Y %H:%M:%S',time.localtime()) self.clock=ttk.Label(self,text=self.now) self.clock.pack() while True: self.now=time.strftime('%a. %b %d %Y %H:%M:%S',time.localtime()) self.clock['text']=self.now[/CODE] simply freezes the program, I've managed to get it to update on certain events like the user hitting a button but … | |
Re: here's an interesting article on the subject "I didn't even know about CubicWeb before it" [URL="http://www.itworld.com/software/192113/pillars-python-six-python-web-frameworks-compared"]http://www.itworld.com/software/192113/pillars-python-six-python-web-frameworks-compared[/URL] | |
Re: <DANIWEB> /es /. to pieces or for pythonistas [code=Python]while true: print('<DaniWeb> rocks') >>><DaniWeb> rocks >>><DaniWeb> rocks >>><DaniWeb> rocks >>><DaniWeb> rocks >>><DaniWeb> rocks >>><DaniWeb> rocks[/CODE] and it has to show in the code format of course. ... | |
Re: Instead of 1 or 0 why don't you return True or False...? Also, even though it's a bad habit of mine, it's considered ugly to use globals when not necessary in a function, you could simply return what you need to, try putting all these things in an array or … | |
Re: use the code tags to display your code | |
Re: It was easier for me with a function, also if you want to get the correct index value remember that python counts the first as 0, so how do you think you should accommodate for that d3fined? | |
Re: I'm confused, so you want to create a free web service that does something that people need done, and you DO or DON'T want it to be surveys? Sorry for the confusion. | |
Re: I would abstract the date box into a function and use string formatting to insert the words date and whatever date is, maybe I'm misunderstanding the problem, but I'd do something like:[CODE]def make_label(word): try: lab='| %s: |\n+-------------------+' % word return lab except TypeError: lab='' for words in word: slab='| %s: … | |
Re: wrong type, watch this magic:[CODE]>>> a=input('code: ') code: 3 >>> a==3 False >>> a '3' >>> print(3) 3 >>> type(a) <class 'str'> >>> type(3) <class 'int'> >>> a=int(a) >>> a==3 True[/CODE] input creates a string, if you want it to be an integer you need to be explicit about it. | |
Does anybody know a good working Python 3.x wrapper for OAUTH2? I'm having issues with the backwards incompatability with simplegeo-python-oauth2.:'( | |
Re: This doesn't belong in code snippets as it is a question, hopefully a mod will fix that soon. Python comments are preceded by # or are within ''' ''' also your indentation is way off. Also, given this code how do you intend the "ATM" to know the customers password? … | |
Early this morning, and I haven't a clue how this slipped by me, I learned about the Android SDK and Python for Android, I did a little research, it's very intriguing. Has anybody worked with this at all? Do most built in libraries and modules work for it? How do … | |
Re: Do you think we just do your homework for you? Do what you can and show us some effort and ask specific questions. Effort in, effort out. | |
Re: [QUOTE]Of course, this ends after the first two draws. The total is a randint (1,10). I guess I don't actually understand what str(sum(total)) does.[/QUOTE] Alright, you're putting in some effort so I'll help you step-by-step as long as you continue the effort. First I'll start with that last part str(sum(total)) … | |
I'm having an issue getting python 3.2 to recognize files in ubuntu, it's the first time I've tried to code while running it. A specific example of the issue is when setting an .ico to be a bitmap logo for a Frame in tkinter it's claiming that there it's not … | |
Re: Show us the code you have so far, you need to show effort around here. | |
Re: [QUOTE=paxton91;1656731]You are not appending the list anywhere. Computer see's list as nothing See's someone needs to input something See's something being printed See's that for every interation it will print a list of nothing And then see's more user input[/QUOTE] and likewise:[CODE]>>>r=[] >>> r.extend((input('Three Things: ').split())) Three Things: my uncle … | |
Re: well I'm not so sure that regex would be necessary for this if it's just a couple words.[CODE]def find_these_words(text): if 'I' in text: print('found I') if 'love' in text: print('found love') >>> t=input('Text>>> ') Text>>> Ilovepython >>> find_these_words(t) found I found love >>>t=input('Text>>> ') Text>>>I love daniweb >>>find_these_words(t) found I … | |
Hello mates, I was wondering if in that vast amount of knowledge floating around here if any of you knew how I could save an image using Python 3.x. I know that PIL is a great, and easy option for Python 2, but I assume there must be some way … | |
Re: your command for that button is going to cause issues, I've noticed whenever you have command=method_or_function(parameter) it immediately attempts to run that command, I've side stepped this by creating methods that know to grab that parameter.I'm not completely sure about the rest of the issue, I'd need to see more … | |
Re: here I'll give you an example of how you should show us your pseudo code, let's say I'm trying to count the number of words in a list that have the letter b in them:[CODE]I need a parameter or input I need a count I need the count to go … ![]() | |
Re: [B]DON'T HIJACK OLD THREADS[/B], Make your own! and 1 is a key. | |
Re: well first of all you need to think out how it should work. So, mathematically how do you find the divisors of a number? Then how would you say that in Python? Effort in effort out around here. | |
Re: Is your indentation correct? [CODE]a=0 while a<10: a+=1 print(a)[/CODE] | |
Re: Post a program you've done so we can gauge your skill level. | |
I just had to get this one out there. I love daniweb, and I'm sure the [B]VAST[/B] majority of the users here do as well. And, unlike many other websites this one's community is made up of some of the greatest IT and Development minds around "as well as noobs … | |
Re: come on now, obviously you have to assign the variable to a value...[CODE]>>> s=10 >>> >>> int(s) 10 >>> print(s) 10 >>> s+3 13[/CODE] but that only answers part of it, first you have to assign s to a string value, HINT: this is done by surrounding the value with … | |
Re: well, from what I'm seeing it looks like it'll come up surrounded by brackets then curly braces.[CODE][{'my','set'}][/CODE] because you made the set a list of the set, and I'm asking myself why you found that necessary... also, work on your names i is not a good name, I looked at … | |
Re: If you want it to continue, regardless of under what circumstance, you need to create a loop. | |
Re: Because you've appended a pointer to that list, so when b changes the pointer sees the change. However if you make a COPY it has its own list. Consider the following interactive experiment: [CODE]>>> f=['bob','jack'] >>> d=['bill'] >>> d.append(f) >>> d ['bill', ['bob', 'jack']] >>> f.pop() 'jack' >>> f ['bob'] … ![]() | |
Re: [QUOTE=Gribouillis;1650305]The method sort() sorts the list in place and returns None [code=python] >>> list1 = ['Herring','used','to','be','abundant','in','the','AtlAntic','Ocean','then','herring','got','overfished'] >>> list1.sort(key=lambda s : s.count('a')) >>> print list1 ['Herring', 'used', 'to', 'be', 'in', 'the', 'AtlAntic', 'then', 'herring', 'got', 'overfished', 'Ocean', 'abundant'] [/code] The function sorted() creates a new sorted list and does not modify … | |
Re: I'm not sure but I'm guessing that something like that would differ for each device, and of course there's the possibility that it may have a domain-specific like language connected to it. I'm intrigued by the idea though. Not to digress but on a semi-related topic I recently came across … | |
Re: looks like someboy's tryin' to make a keylogger :icon_wink: | |
Re: Why are you having the user input the number of transactions? It just seems to me like that would become repetitive since most transactions in a month are only made once. To subtract the amount from the total balance you should - from current balance. I'll give you a hint … | |
Re: I think it's pretty important to incorporate functions, ESPECIALLY since you're a newbie. It wasn't that long ago that I was wrapping my head around functions. They're great because the can be used more than once, it's also a quick concept to begin to understand, it's simply a way of … | |
Re: Why wouldn't you be able to? Post the source. | |
I'm trying to figure out how to allow users to upload images, I'm starting easy with something I know tkinter can handle with no coercion, gif files. I've figures a bit out, but I'm having issues getting the image to actually SHOW. [CODE]from tkinter import * from tkinter.filedialog import askopenfilename … | |
Re: This was not a real thread... I'm going to go cry | |
Re: raw_input is used for user input on the command line, or in IDLE for example:[CODE]word=raw_input('Enter a word: ') print word[/CODE] it is important to note that raw_input does not work in python 3.x it was combined with input() after python 2. If you're not sure which one you are using, … | |
Re: Well Mike, welcome to Python, I'm sure you'll love it. Here's a snippet by Vegaseat regarding TG [URL="http://www.daniweb.com/software-development/python/code/216557"]http://www.daniweb.com/software-development/python/code/216557[/URL] Also there are tons of free ebooks on learning python, some handy tutorials at [URL="http://thenewboston.com"]http://thenewboston.com[/URL] "I didn't use them, but I viewed them after I learned the material and wished that I … | |
Re: You get one chance to justify why you would want to do that. |
The End.