4,305 Posted Topics

Member Avatar for nimmyliji

After you read Gribouillis' suggestion and also read some more of the Python tutorial on string operations, you could explore the hint below. Hint, you could go through your data string line by line this way ... [code]data_str = """\ 0,Salary,14000 0,Bonus,5000 0,gift,6000 """ for line in data_str.split('\n'): print(line) [/code]... …

Member Avatar for vegaseat
0
130
Member Avatar for mrnutty

Just about anybody can learn to play the piano, but very few can be a concert pianist. To be good at playing the piano takes real talent and a special mind. The same goes for programmers. To hire a good one you have to hear them play, or in this …

Member Avatar for vaultdweller123
0
1K
Member Avatar for ITKnight

[QUOTE=Serunson;524062]I don't really like Football/Soccer to be honest, i mean i watch the international matches, but i really don't care much. Basketball, now there's a proper sport :P Action all the way! Go Guildford Heat! :)[/QUOTE]Basketball is like playing soccer without a goalie, it's too frigging easy to score! On …

Member Avatar for HelloMe
0
202
Member Avatar for SOURP0PCORN

You have to pass the required arguments to an from your functions. Look at your modified code carefully ... [code]#!C:\Python26\python.exe # Three-times-the-square-root-of-your-age.py # # This is a python program that # will input the user's name and age # the output will be 3 times the # square root of …

Member Avatar for vegaseat
0
189
Member Avatar for Nick Evan

I started the year with water pipes bursting in my house. The plumber said that all the pipes are butyl rubber (gray plastic stuff), outlawed since 1995 and need to be replaced with something more modern. I hope that niek_e's insurance will pay for most of his car damage. No …

Member Avatar for apegram
0
294
Member Avatar for rwbarrette

Try ... [code] def OnLeftDown(self, event): print 'Left Button clicked at:', event.Coords # clear all objects off the canvas self.canvas.ClearAll() self.canvas.ZoomToBB() [/code]

Member Avatar for vegaseat
0
443
Member Avatar for ~s.o.s~

[QUOTE=~s.o.s~;1111811]I wish all the Indians out there a very Happy 61st Republic Day! :-)[/QUOTE]A fantastic achievement! Congratulations! The USA will celebrate its 234th (or is it the 235th) Independence Day on July 4th. It took quite a bid of bloodshed and many years to kick the British overlords out then.

Member Avatar for vegaseat
1
206
Member Avatar for Salem
Member Avatar for nimmyliji
Member Avatar for JasonHippy
0
485
Member Avatar for chankya

What currency are you using to buy oil from Saudi Arabia or manufactured goods from China?

Member Avatar for GrimJack
0
245
Member Avatar for persianprez

You could split the string once ... [code]mystr = "F4K8*72-432*82T-74" mylist = mystr.split("*", 1) print mylist # ['F4K8', '72-432*82T-74'] # add the missing '*' back in print "part1 = %s*" % mylist[0] print "part2 = %s" % mylist[1] [/code]

Member Avatar for persianprez
0
239
Member Avatar for corbenik

Your problem may be that you are also using [B]file[/B] for variable names. Also [B]if(not os.path.isdir(path):[/B] should be [B]if not os.path.isdir(path):[/B] This works (Windows XP) ... [code]import os class Subfile(file): def __init__(self, path): if not os.path.isdir(path): file.__init__(self, path) self.__path = path def listFiles(self): if os.path.isdir(self.__path): for file1 in os.listdir(os.path.abspath(self.__path)): yield …

Member Avatar for corbenik
0
125
Member Avatar for vsagarmb
Member Avatar for vmanes

Who says that a book written by a programmer has to be written in a dull and boring manner? Let them throw in a fresh and mildly spicy word every now and then to stimulate the reader's palate.

Member Avatar for ddanbe
1
334
Member Avatar for sosdown

We will only help those who show some effort! In other words, show us some Python code you have tried to solve your problem. The problem is real easy to solve, hint ... [code]# "f(x)= x + 2 - 3" implies the function below def f(x): return x + 2 …

Member Avatar for vegaseat
0
65
Member Avatar for code177

Here is a code snippet that uses sliders to adjust the RGB values of a color. Look at: [url]http://www.daniweb.com/code/snippet216694.html[/url]

Member Avatar for vegaseat
0
64
Member Avatar for Salem
Member Avatar for sniperx99

Since we don't have your data file, we can simply create a sample test file and use that to show you how you can extract the numeric data after the marker ... [code]# create a test data string raw_data = """\ a b c DATA 11 22 17.5 45 19.5 …

Member Avatar for sniperx99
0
84
Member Avatar for dude93
Member Avatar for Stefano Mtangoo
0
85
Member Avatar for Salem

Hate to think what will happen if those war robots return [U]home[/U] infected with a computer virus.

Member Avatar for vegaseat
1
179
Member Avatar for rixxir

You have done a fine job so far test printing your data. Now let the user input a month with the correct spelling. Index the month using: [B]mon_ix = months.index(mon_str)[/B] That index matches the temperature data index, pull out he right list with: [B]mon_temps = temperatures[mon_ix][/B] Now create a temporary …

Member Avatar for vegaseat
0
155
Member Avatar for MichelleCrews
Member Avatar for rahul8590
Member Avatar for funfullson

A simple example of using module timeit ... [code]# using Python module timeit on a simple statement # (timeit turns off garbage collection) import timeit stmt = "x = (12345679 * 63)//7" # use n=1000000 passes (this is also the default) # this way the result will be time per …

Member Avatar for vegaseat
0
106
Member Avatar for forbushshooter

You may want to read up on passing parameters/arguments to and from functions: [url]http://www.daniweb.com/forums/post104853.html#post104853[/url] Notice that the code examples are written to be used with the older Python2 and the newer Python3 syntax. Also, check your spelling of function names and don't use the same names for variables and functions.

Member Avatar for vegaseat
0
92
Member Avatar for PixelHead777

In my humble opinion you need to learn Python really well before you tackle many of those projects. Thoroughly read the initial post at: [url]http://www.daniweb.com/forums/post159472.html#post159472[/url] You raised some questions that needed to be answered. Those in turn would have cluttered the project thread. The rules are there to prevent this. …

Member Avatar for Ene Uran
0
157
Member Avatar for Begjinner

I assume you are talking about the Python shell that comes up with IDLE as an output window. You have to tell Python which type of encoding to use, try this ... [code]# -*- coding: cp1252 -*- print chr(233) # é print chr(130) # ‚ [/code]

Member Avatar for vegaseat
0
346
Member Avatar for BirdaoGwra

Kindly let us know which GUI toolkit you are using. Also, can you give us a small sample of your code?

Member Avatar for BirdaoGwra
0
137
Member Avatar for vegaseat

Wallpaper or tile images are small images that can be spread across a background repetitively. A common practice on web pages. The surface created with wx.PaintDC() can be used for this effect and still allows other widgets to be put on top of the wallpaper. The small tile image is …

Member Avatar for vegaseat
1
984
Member Avatar for trips.dude

If you put the number of primes you want, you called it x, in the outer loop range() you will get x numbers, but since not all of them are prime it will print less than x numbers. You need to make the outer loop an endless loop with a …

Member Avatar for samvinogar
0
17K
Member Avatar for punter999
Member Avatar for mahela007

You can also keep a program busy with a for loop, but the exact delay will depend on your computer's capabilities.

Member Avatar for mahela007
0
284
Member Avatar for pankti
Member Avatar for calccrypto
Member Avatar for lrh9

Unix/Linux uses '\n' Windows uses '\r\n' Mac uses '\r' for newlines, which manifest themselves in documents/text written on these machines. Python by default uses "Universal Newline" support which translates all of the different newlines to '\n' when you open a document/text file. As to "Standard Newline", there is no agreed …

Member Avatar for HiHe
0
174
Member Avatar for anishakaul
Member Avatar for a1eio

A simple way to make a ticker ... [code=python]# using Tkinter to create a marquee/ticker # uses a display width of 20 characters # not superly smooth but good enough to read import Tkinter as tk import time root = tk.Tk() # width=width chars, height=lines text text = tk.Text(root, width=20, …

Member Avatar for donnie6680
0
1K
Member Avatar for Schecter

Interesting! So what is your solution? Actually, some of those things cannot grow exponentially. There won't be enough consumers around! There is also quite a limit of college educated folks that society can productively absorb. We still need folks that grow, harvest and prepare the food, deliver the goods, fix …

Member Avatar for BestJewSinceJC
2
109
Member Avatar for garyinspringhil
Member Avatar for woooee
0
154
Member Avatar for nomemory

To access a dictionary key use [B]print Card.VALUES["1"][/B] Also in your case there is no key named "1"

Member Avatar for nomemory
0
400
Member Avatar for itsbrad212

What does userlist look like? You seem to constantly overwrite the result in a newly created label at the same position.

Member Avatar for Stefano Mtangoo
0
146
Member Avatar for Stefano Mtangoo

Here is a very simple example ... [code]# show an image using a wx.PaintDC() canvas import wx class ImagePanel(wx.Panel): """ create a panel with a canvas to draw on""" def __init__(self, parent): wx.Panel.__init__(self, parent, wx.ID_ANY) # pick a .jpg, .png, .gif, or .bmp image file you # have in the …

Member Avatar for Stefano Mtangoo
0
136
Member Avatar for lllllIllIlllI
Member Avatar for garyinspringhil

You are mixing spaces and tabs as indentations which makes a mess out of your code, at least in my editor.

Member Avatar for garyinspringhil
0
98
Member Avatar for Goonie12

My advice, start writing each function using test parameters and temporary test prints. See if you get the expected results. If you have problems give us the code you have and we will try to help.

Member Avatar for vegaseat
-3
187
Member Avatar for Jonhpt

Why don't you write a simple program using module threading and test it with Windows XP and then Windows7 and check the results. Some Windows versions have problems with prioritizing threads. You can also use this simple test program that shows you how to turn off a thread ... [code]# …

Member Avatar for vegaseat
0
183
Member Avatar for cascade3891

If you have to include a series of small image files with your program distribution, it might be simpler to embed the images as base64 strings into your code. The strings are easy to generate. For an example see: [url]http://www.daniweb.com/forums/post1112502.html#post1112502[/url]

Member Avatar for vegaseat
0
1K
Member Avatar for NicholasE
Member Avatar for snake03
Member Avatar for vegaseat
0
108
Member Avatar for vegaseat

A lotto simulator with a twist, you pick the winning numbers and the computer buys the lotto tickets. Anyway, the computer at least generates the tickets and checks how many of them would match the winning numbers you selected. Let's assume you would be the state lotto commissioner and your …

Member Avatar for lyndon enero
0
7K

The End.