Posts
 
Reputation
Joined
Last Seen
Ranked #52
Strength to Increase Rep
+15
Strength to Decrease Rep
-3
92% Quality Score
Upvotes Received
337
Posts with Upvotes
256
Upvoting Members
105
Downvotes Received
19
Posts with Downvotes
19
Downvoting Members
13
118 Commented Posts
~1.38M People Reached
Interests
Guns, target/sharp shooting, martial arts, hunting, cooking
Favorite Tags

1,175 Posted Topics

Member Avatar for Steph102

I would avoid using the Python shell to write multiline programs. Use one of the Python editors like IDLE, wirte your program, save it and run it. This would have given you an error message like: NameError: name 'timesflipped' is not defined Using FengG's advice your program should look like …

Member Avatar for Reverend Jim
0
16K
Member Avatar for vegaseat

Some cause happiness wherever they go; others, whenever they go. -- Oscar Wilde

Member Avatar for Reverend Jim
15
13K
Member Avatar for Duki
Member Avatar for linux

According to my engineering professor, the reason there is a variety of computer languages is that each language (at least the popular once) was written for a purpose. Python was not written to make Operating Systems, but C was (for Unix). So it would be a little silly to use …

Member Avatar for Thulan
2
2K
Member Avatar for jopeto

Probably the easiest way to do this is to use the local variable dictionary vars() to create new variables on the fly: [code=python]food = 'bread' vars()[food] = 123 print bread # --> 123 [/code]You can print out vars() to see what's going on.

Member Avatar for Rayalacheruvu
1
102K
Member Avatar for tony75

Looking at main.py this program is a nightmare of imports. https://github.com/PicciMario/iPhone-Backup-Analyzer-2/blob/master/main.py

Member Avatar for Andreas_7
0
22K
Member Avatar for anveshi
Member Avatar for rproffitt
0
15K
Member Avatar for Reverend Jim

The American News Media can only handle three major events at a time.

Member Avatar for John_smith
10
21K
Member Avatar for The Dude
Member Avatar for joy_deep

Try this: ''' wxBoxSizer101.py button1 at upper right corner button2 at lower right corner ''' import wx class MyFrame(wx.Frame): def __init__(self, parent, mytitle, mysize): wx.Frame.__init__(self, parent, wx.ID_ANY, mytitle, size=mysize) self.create_widgets() def create_widgets(self): self.button1 = wx.Button(self, wx.ID_ANY, label='Button1') self.button2 = wx.Button(self, wx.ID_ANY, label='Button2') # use a box sizer to lay out …

Member Avatar for Jonny_4
0
1,000
Member Avatar for vegaseat

A simple timing example: import time def print_timing(func): """ a decorator function to time another function time.clock() works on Windows systems only you can use time.time() instead, but it gets updated less frequently and can give 0.0 results on faster functions """ def inner(*arg): """*arg are the arguments of function …

Member Avatar for amir_19
3
24K
Member Avatar for vegaseat

wxMediaCtrl uses native backends to render media, for example on Windows there is a ActiveMovie/DirectShow backend, and on Macintosh there is a QuickTime backend backend options:. wx.MEDIABACKEND_GSTREAMER for linux/unix wx.MEDIABACKEND_QUICKTIME for Mac

Member Avatar for bunkus
2
4K
Member Avatar for Ancient Dragon

How do you get a sweet little 80-year-old lady to say the F word? Get another sweet little 80-year-old lady to yell “BINGO!”

Member Avatar for jkon
4
4K
Member Avatar for vegaseat
Member Avatar for Hillzy

Put the code between code tags. Read the lightgray message in the background of the Quick Reply field below. Or read: [url]http://www.daniweb.com/forums/announcement114-3.html[/url]

Member Avatar for Faro_1
0
3K
Member Avatar for RMartins

The function sqrt(x) returns a float: [code=python]import math x = 9 y = math.sqrt(x) print y, type(y) # 3.0 <type 'float'> [/code]If you want the result to be an integer use int(y).

Member Avatar for pythonBasic
0
726
Member Avatar for sneekula

In the last couple of threads people have used the Python class, but really don't seem to know how to use them properly, or why to use them. Hence my question: "Why would you use a class in Python?" I though only Java forces you to use OOP.

Member Avatar for Vineetha_1
0
4K
Member Avatar for vegaseat
Member Avatar for vegaseat

Import the module shutil, it has functions for copying and moving files, copying whole directory trees, deleting directory trees and more.

Member Avatar for vegaseat
23
34K
Member Avatar for vegaseat

Predict the outcome of this Python code: [code=python]def sub_one(x): print "x before if -->", x if x > 1: x = x - 1 sub_one(x) print "x after if -->", x return x x = 5 final = sub_one(x) print "final result -->", final [/code]Can you explain the odd behaviour?

Member Avatar for vegaseat
20
18K
Member Avatar for vegaseat

Each king in a deck of playing cards represents a great king from history: Spades --> King David Clubs --> Alexander the Great Hearts --> Charlemagne Diamonds --> Julius Caesar

Member Avatar for vegaseat
11
9K
Member Avatar for sneekula

I got infected right after a Java and Adobe update on my Windows7 machine. folder \jnihmpibahpjjmcodbopcpdaelkbpjnc is most likely a random generated folder. Note on malware **PriceLess** (pops up as Chrome extension, highlights strings for ads): PriceLess is in folders: C:\Users\HomeGroupUser$\AppData\Local\Chromatic Browser\User Data\Default\Extensions\jnihmpibahpjjmcodbopcpdaelkbpjnc\5.2 C:\Users\HomeGroupUser$\AppData\Local\Comodo\Dragon\User Data\Default\Extensions\jnihmpibahpjjmcodbopcpdaelkbpjnc\5.2 C:\Users\HomeGroupUser$\AppData\Local\Google\Chrome\User Data\Default\Extensions\jnihmpibahpjjmcodbopcpdaelkbpjnc\5.2 C:\Users\HomeGroupUser$\AppData\Local\Google\Chrome SxS\User Data\Default\Extensions\jnihmpibahpjjmcodbopcpdaelkbpjnc\5.2 …

Member Avatar for henri2398
1
653
Member Avatar for Ancient Dragon

In my book the only thing that lives on is meaningful communication you made with people that survive you.

Member Avatar for 45ish
0
1K
Member Avatar for vegaseat

Here is a comparison of some common Python GUI toolkits. These were created on my Ubuntu/Linux machine, because I could never get PyGTK to go on my Windows Vista machine. I followed the installation routine carefully, but there was always a dll missing, or an entry point wasn't found, or …

Member Avatar for vegaseat
9
45K
Member Avatar for RobertHDD
Member Avatar for DragonMastur

There is also an error in line 12. Since you are not running Python3 but Python2 tkinter should be Tkinter

Member Avatar for DragonMastur
0
427
Member Avatar for RobertHDD

According to Einstein the Sun uses up more and more matter, its gravitational pull should lessen and the Earth should move further away.

Member Avatar for RobertHDD
0
874
Member Avatar for Niloofar24
Member Avatar for fonzali
Member Avatar for Niloofar24

Normally you build a house from the bottom up. Try to understand the basics of Python first and put the windows in later.

Member Avatar for Niloofar24
0
10K
Member Avatar for ivel

@ivel I looked at the code you have written and at NathanOliver's helpful suggestions. I came to the conclusion that you need beginner's help. I took your code and corrected it, please study it: /* modulus_exercise101.cpp Write a program that counts the numbers from 3 to 117. For multiples of …

Member Avatar for NathanOliver
0
293
Member Avatar for marcelocent
Member Avatar for Niloofar24
Member Avatar for sneekula
0
11K
Member Avatar for kouty

Avoid using Python function names like **list** for variable names. if you use list = [1, 2, 3] and later abc_list = list('abc') it won't work!

Member Avatar for sneekula
0
206
Member Avatar for kouty

Hmm: ''' str_find_sub_index.py explore s.find(sub[ ,start[,end]]) returns index or -1 ''' text = "trans panamanian bananas" sub = "an" start = 0 count = 0 while True: ix = text.find(sub, start) if ix < 0: break # move up start in function find() start = ix + 1 count += …

Member Avatar for Gribouillis
0
409
Member Avatar for Niloofar24

I would use **with**, it closes your files properly. Also use a protocol for larger files: import pickle fname = "films.db" with open(fname, "wb") as fout: # default protocol is zero # -1 gives highest prototcol and smallest data file size pickle.dump(favorite_movies, fout, protocol=-1) # pickle load the object back …

Member Avatar for sneekula
0
179
Member Avatar for vegaseat

Just a little faster than isprime2(): def isprime5(n): if n == 2 or n == 3: return True if n < 2 or n%2 == 0: return False if n < 9: return True if n%3 == 0: return False sqr = int(n**0.5) f = 5 while f <= sqr: …

Member Avatar for vegaseat
2
3K
Member Avatar for sneekula

You can accesss the clipboard simply by using the Tkinter GUI toolkit that comes with your Python installation.

Member Avatar for TrustyTony
1
14K
Member Avatar for shafter111

The elegant thing about the **while True** loop is that you can break at a given point between statements.

Member Avatar for sneekula
0
31K
Member Avatar for cambalinho

Something like that: // removes the third bit, simple way to create upper case char char toupper(char ch) { return ch & 0xDF; } Sorry doesn't handle numbers etc.

Member Avatar for sneekula
0
343
Member Avatar for <M/>
Member Avatar for Reverend Jim
0
181
Member Avatar for Shaji_1

Here you go: s = "happy Hello World!" print(s) print(s.capitalize()) print(" ".join(w.capitalize() for w in s.split())) print(s.lower()) print(s.upper()) print(s.swapcase()) ''' my result --> happy Hello World! Happy hello world! Happy Hello World! happy hello world! HAPPY HELLO WORLD! HAPPY hELLO wORLD! '''

Member Avatar for TrustyTony
0
307
Member Avatar for sneekula

I have a Toshiba Satellite notebook with Windows7 OS. How would I go about it to replace Windows7 with Kubuntu?

Member Avatar for RobertHDD
0
166
Member Avatar for Niloofar24

If you saved your file as hello.py somewhere Python looks for, do this from the shell: >>> import hello >>> hello.thefunc()

Member Avatar for Niloofar24
0
1K
Member Avatar for sneekula

On Windows7 I am trying to read file C:\programdata\microsoft\application virtualization client\SoftGrid Client\sftfs.fsd using a Python program, but I get a PermissionError. How do I get permission? Why does folder programdata not show in the Microsoft file manager/explorer?

Member Avatar for RobertHDD
0
256
Member Avatar for kouty
Member Avatar for kouty
0
189
Member Avatar for Ola Loay
Member Avatar for Rimas_1
Member Avatar for sneekula

On my Raspberry Pi computer I did a search for PIL and matplotlib with apt-cache search python but could not find anything close in the list. Is PIL/Pillow and matplotlib available for Linux and what is it called? The Raspberry Pi has Python27 and Python32 installed.

Member Avatar for vegaseat
0
394
Member Avatar for Reverend Jim
Member Avatar for RobertHDD
0
118

The End.