153 Posted Topics

Member Avatar for peste19

maybe I'm misunderstanding, but wouldn't something simple like [CODE]def make_norm_lis(entry): lis=[] for letter in entry: if letter.isalpha(): lis.append(letter) else: lis.append(' ') lis=''.join(lis) lis=lis.split() return lis[/CODE] work? [CODE]>>> st='!@#this@#$is//sparta' >>> print(make_norm_lis(st)) ['this', 'is', 'sparta'] >>> >>> work='i.going.to.work' >>> >>> print(make_norm_lis(work)) ['i', 'going', 'to', 'work'][/CODE]

Member Avatar for TrustyTony
0
177
Member Avatar for bonyjohn

There's a sticky on beginner project ideas at the beginning of the forum. Check 'em out. Also there are a couple [URL="http://www.daniweb.com/software-development/python/threads/257510"]more advanced projects here.[/URL]

Member Avatar for TrustyTony
-1
147
Member Avatar for <LDJ>
Member Avatar for jonjacob_33_0

Why wouldn't you just want the list??? Is it just a matter of printing? If not why not just return a list of integers??[CODE]>>> def renum(lis): return [int(num) for num in lis] >>> a=['1','2','3'] >>> >>> b=renum(a) >>> b [1, 2, 3][/CODE]

Member Avatar for JoshuaBurleson
0
818
Member Avatar for sofia85

Also, I tried this with a file someone else posted here a couple days ago, it had a different format, but I feel the idea here is the same, the way I broke it down is just different because of the format:[CODE]File: 115 139-28-4313 1056.30 135 706-02-6945 -99.06 143 595-74-5767 …

Member Avatar for JoshuaBurleson
0
4K
Member Avatar for Y DIY
Member Avatar for pelin

well I've never used graphics but I've used livewires;though I must admit very rarely, however maybe showing you what this "with only one falling snowflake for now" would look like with livewires:[CODE]from livewires import games games.init(screen_width=400, screen_height=400, fps=60) flake=games.load_image('snowflake.png',transparent=True) cabin=games.load_image('snowy_cabin.jpg',transparent=False) games.screen.background=cabin class Snow(games.Sprite): def update(self): if self.bottom>games.screen.height: self.y=games.screen.height/20 snow=Snow(image=flake, x=games.screen.width/2, …

Member Avatar for richieking
0
111
Member Avatar for nw240x

Show us some effort, if you've been working on it for three days you must have some code, post it. And use the code tags when you do. Also read the forum rules.

Member Avatar for nw240x
0
421
Member Avatar for JoshuaBurleson

Does anybody know how to clear all widgets; labels, buttons, etc. from a tkinter frame so that new ones may be put in their place? I've tried self.destroy() but that makes the frame unreachable, and self.grid_forget() followed by, "and without" self.grid() neither of these work, at least not as expected. …

Member Avatar for JoshuaBurleson
0
30K
Member Avatar for francisgan9

ohhh tony and his one-liners ;-) also, I'm not sure why you thought checking phonebook.items was the most prudent style...I hope you already know what's wrong with that choice; why not phonebook.keys()?

Member Avatar for JoshuaBurleson
0
1K
Member Avatar for Joe Shmoe

Among several other things, you're not telling python to do with that file your opening, you're not going to like the output, how about open(file,'r')...

Member Avatar for JoshuaBurleson
0
115
Member Avatar for sjgood

I'm going to over complicate the matter,as to show you step by painful step how the process goes, in my mind that is. I'm not going to make functions either, let's see you re-engineer my code, and hopefully simplify it. Also, post your result. "Note that help.txt was a copy …

Member Avatar for JoshuaBurleson
0
328
Member Avatar for dinilkarun

Don't bump old threads, particularly old solved threads...this one is six years old for goodness sake...

Member Avatar for JoshuaBurleson
0
163
Member Avatar for Lomholdt

so you know, the function you created doesn't need the parameter word, but if you were abstracting the function, which is often considered better; you could make it something sort of like: [CODE]def no_e(word): noe=word.replace('e','') return noe[/CODE] and then iterate through the words in the file and no_e them. my …

Member Avatar for JoshuaBurleson
0
153
Member Avatar for dwbrian

This is not the place to start python my friend. It's a very easy language to learn, I suggest you check out our Starting Python sticky thread, and there are tons of books on learning python, many of them free. And I've heard Bucky, at thenewboston has a great set …

Member Avatar for JoshuaBurleson
0
180
Member Avatar for HarshaS2

also use code tags when posting code. And as woooee said, this isn't doyourhomeworkweb it's Daniweb, read the forum rules.

Member Avatar for JoshuaBurleson
0
401
Member Avatar for JoshuaBurleson

As most of us know in tkinter in order to properly display an image it must be assigned to a variable, however what if you don't know that amount of images that are going to be necessary? i.e. A friend list, how would one display the friends pictures?

Member Avatar for JoshuaBurleson
0
217
Member Avatar for JoshuaBurleson

I'm trying to utilize partial in order to bind an image to it's associated name in a list "you'll see what I mean" but I'm getting a TypeError thrown on it, this is my first time trying to work with partials so I'm just not quite sure what's going on: …

Member Avatar for JoshuaBurleson
0
190
Member Avatar for adrain91

Worked fine for me, line 6 "guess= list(guess)" was unnecessary, when you split it, you're splitting the string into a list. Also, how are you going to account for user error? ie. what if I entered: Shoot: f7, c4, c3, b1, a1

Member Avatar for adrain91
0
108
Member Avatar for pfm200586

Rev Jim is right, check your algorithm, when you're simply assigning each of them to a random number there's no guarantee that they will all be different. [ICODE]Have an empty array while the length of the array is less than six generate a random number if that random number isn't …

Member Avatar for JoshuaBurleson
0
332
Member Avatar for hladdha.bhl2009

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 …

Member Avatar for JoshuaBurleson
0
255
Member Avatar for Tyler212

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

Member Avatar for ScottieF
0
2K
Member Avatar for asong

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.

Member Avatar for TrustyTony
-1
423
Member Avatar for Tcll

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.

Member Avatar for JoshuaBurleson
0
2K
Member Avatar for Dane2259

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 …

Member Avatar for JoshuaBurleson
0
125
Member Avatar for bigredaltoid

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 …

Member Avatar for TrustyTony
0
404
Member Avatar for M.S.

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

Member Avatar for M.S.
0
6K
Member Avatar for JoshuaBurleson

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 …

Member Avatar for JoshuaBurleson
0
214
Member Avatar for jagan605
Member Avatar for Cupidvogel

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]

Member Avatar for Cupidvogel
0
211

The End.