4,305 Posted Topics
Re: In the news lately: Google seems to take this endless virus check stuff serious. Their new Google Chrome OS is supposed to be safe from virus trespass. . | |
Re: [QUOTE=iliketacos;906567]nevermind i got it i forgot to specify len(post) in parse[/QUOTE]Thanks for letting us know! | |
Re: [QUOTE=jlm699;906499]Nope, sorry same thing. You're saying that link allows you to download 2.8 and it works? Then maybe I [B]AM[/B] crazy, because it still takes me to the "older versions" (2.7 and earlier) page. Yes, this is exactly what I'm experiencing. So maybe I'm [B]NOT[/B] crazy?![/QUOTE]You are not crazy, or … | |
![]() | Re: This might be a little simpler ... [code=python]data = """\ dasj dhsahdwe dhasdhajks ewqhehwq dsajkdhas edward das dsaw das daswf fjdk ewf jken dsajkw dskdw hklt ewq vn1 daskcn daskw """ # find the length of the longest word and add 2 length = max(len(w) for w in data.split()) + … |
Re: You can simply modify your code a little ... [code=python]test = open("Hello_World.txt", "w") test.write("Hello World!") test.close() test = open("Hello_World.txt", "r") print test.read() test.close() print '-'*20 test = open("Hello_World.txt", "a") # add the newline char in front test.write("\nhello world!") test.close() test = open("Hello World.txt", "r") print test.read() test.close() """ my result … | |
Re: Thanks shadwickman for your thoughts. Using C:/python26/stuff/bg.jpg with the Windows OS would be recommendation too. | |
Re: Here is an example for the use of deepcopy with a nested list. First without ... [code=python]# a nested list list1 = ['a', 'b', 'c', 'd', [1, 2, 3]] list2 = [x for x in list1] # now replace 2 with 77 in list1 list1[4][1] = 77 print(list1) # ['a', … | |
Re: Did Obama cause the drop in the US stockmarket? Maybe, there was a similar drop in 2002 after W took over. It still doesn't explain why the Japanese stockmarket went through the same decline a few months earlier. | |
Re: The simplest way is to do it in a do ... while() loop like this: [code=cplusplus]// Dev C++ #include <cstdlib> #include <iostream> using namespace std; int main() { int n; // keeps looping until a number < 100 is entered do { cout << "Enter an integer number (< 100): … | |
Re: The py2exe module does not compile to an executable. It packages your Python bytecode files, other needed files and the Python interpeter to run from an executable file. At this point py2exe is not yet out for Python3. | |
Re: Actually an interesting project that combines images and text information. I would use a record like structure easily implemented by a class ... [code=python]# -*- coding: cp1252 -*- # My encyclopedia. # An interactive encyclopedia which shows # pictures and information about them. import Tkinter as tk from PIL import … | |
Re: I took the liberty to use sneekula's test setup ... [code=python]# a test setup for pickle dump and load # note that pickle does not save the class itself # if the dumped data file is used in another program, # you need to code a matching class in that … ![]() | |
Re: [QUOTE=tomtetlaw;906936]Thanks guys, it turns out that I had to only put the function name, not call the function. :)[/QUOTE]Better test it, that won't work! | |
Re: If you are using Python2 ... [code=python]import urllib pagetext = urllib.urlopen("http://www.python.org").read() print pagetext [/code]For Python3 use ... [code=python]import urllib.request pagetext = urllib.request.urlopen("http://www.python.org").read() print(pagetext) [/code] | |
Re: Jif low fat extra chrunchy. My choosy mom picked it out! Tastes good as long as you don't put any Smucker's Jelly on it! Actually, I like Trader Joe's Almond Butter better, but I have to hide it from my students. | |
Re: I used IDLE and Python25, for some odd reason IDLE takes unicode best. Looks like regex works fine, but the resulting string escapes the escape ( '' turns into '\' ) ... [code=python] # -*- coding: cp1252 -*- # fiddling with unicode import re def func(mylist): for e in mylist: … | |
Re: Ghosts exist only in a person's mind. Pretty harmless thing most of the time. Odd stuff happens and one has to explain it somehow. | |
Re: [QUOTE=jbennet;477363]fart isnt a bad word, its socially acceptable.[/QUOTE]Not quite sure what it has to do with immigration, I prefer "passing wind" or "singing the backdoor song" | |
Re: I think there is a Python plugin available for NetBeans. Another good IDE is DrPython that is wxPython based, clean and quick, and works on Windows, Linux, and Mac Unix. | |
![]() | Re: Write the basic architecture of a new Operating System that would be secure from virus attack. ![]() |
Re: I have met a fair number of intelligent women in my life, good looks and all. Invariably, the men they were interested in were the physical type, sort of SS troopers on steroids. That left me out in the cold! Maybe I am just lucky! | |
Re: @Your_mum Firstly, welcome to our Python community. Secondly, I recommend to create a new thread when you have a different question. Also. please be a bit more specific about the thread title. | |
![]() | Re: If you have a Linux/Unix machine then you can use module termios ... [code=python]# get a character without pressing Enter # see http://www.daniweb.com/forums/post898236-3.html import termios # linux/unix Python installations only def getkey(): fd = sys.stdin.fileno() old = termios.tcgetattr(fd) new = termios.tcgetattr(fd) new[3] = new[3] & ~termios.ICANON & ~termios.ECHO new[6][termios.VMIN] = … |
Re: [QUOTE=tomtetlaw;901181]So input() in python 3 returns a string?[/QUOTE]Yes, that's what a quick look in the manual will tell you. | |
Re: [QUOTE=wildgoose;900287]Are you using a 32-bit compiler or a 16-bit? If 16-bit then you have a problem! 100000000 is 05f5e100 in hex requiring 32-bits to store. Since you are being signed due to the -1, It seems a Highes score of 32767 would be a more suitable test, IFF you are … | |
Re: If you are filthy rich, you can buy "Programming in Python3" by Mark Summerfield. That book has plenty of exercises at the end of each chapter. The book promisses to have "extensive downloadable example code" on the back page, so far I have not found it!!!! | |
Re: Thanks for the info, we can now stop scratching our heads! | |
Re: The Brits talk kind of funny, but that is all the difference I notice. | |
![]() | Re: Remember, using Microsoft's msvcrt.dll dynamic link library makes your program specific for the Windows OS. |
| |
![]() | Re: Think about this, You want to start with a line of 9 spaces and one '*' , the second line is 8 spaces and two '*' and so on, with the last line zero spaces and ten '*'. So you have to decrease the space counter and increase the '*' … |
Re: The temporary sys.path.append() specific to your program is probably the best solution in your case. | |
| |
Re: The main idea about using module glob is to look for specific files. If you give glob a more specific wildcard like '*.jp*' then it will only list .jpg or .jpeg files and not subdirectories. The way you are using glob makes little sense and you might better use os.listdir(folder). | |
Re: The function print() is part of the core of Python (Python25 and Python30) It simply prints to the console what you put into its parameter: [code=python]print(2 + 3) pi = 355/113.0 print(pi) print("pi = %0.4f" % pi) print('Helen') print('') s1 = 'Jim is ' x = 24 s2 = ' … | |
Re: Here is a typical wxPython template you can start with ... [code=python]# a wxPython general frame and button template # click the button and show a string in a label import wx class MyFrame(wx.Frame): def __init__(self, parent, mytitle, mysize): wx.Frame.__init__(self, parent, -1, mytitle, size=mysize) self.SetBackgroundColour("yellow") # self allows path to … | |
![]() | Re: I used to program with Delphi for many years, pretty much the original RAD. It used object Pascal and had a great form designer. Lots of folks supplied components/widgets for it. However, Borland started screwing around with it, bringing out expensive new versions frequently, making older versions incompatible to cash … |
Re: Just a note to remind you that range(start, stop, step) has a step option, so you could have used ... [code=python]for celsius in range(0, 101, 2): fahrenheit = 1.8 * celsius + 32 print ('%0.2f %0.2f' % (celsius,fahrenheit)) [/code]All in all, nice clean coding style. Hope you enjoy your Python … | |
Re: Give us a short code of what gives you problems, and we could actually help. | |
![]() | Re: With wxPython your input() and raw_input() are done with the wx.TextCtrl() widget and you need to bind the return key or use a button widget. Also, wxPython has its own timer. Also, do all of us a favor and don't use those horrible "8 space tabs" for indents! |
Re: Let's hope your code does not look like the one you showed. Try to run just this ... [code=python]import wx [/code]If a similar error message comes up, then there is something wrong with your wxPython installation. | |
Re: Mindreading is not my strength, so please post some code! | |
Re: In Python you don't have to initialize a list. You simply start with an empty list and append to it ... [code=python]print "You are asked to enter ten 2 digit integers ..." # an empty list to start with mylist = [] for k in range(10): print k + 1,') … | |
![]() | Re: Here is the poop ... [code=python]# getpass works in the Windows Console itself # and does not echo the password as it is entered: # (does not work in DrPython or IDLE output windows) import getpass #usr = getpass.getuser() usr = "Frank" pwd = getpass.getpass("enter password for user %s: " … |
Re: This is an example on how to run Python code externally ... [code=python]# pipe the output of calendar.prmonth() to a string: import subprocess code_str = \ """ import calendar calendar.prmonth(2006, 3) """ # save the code filename = "mar2006.py" fout = open(filename, "w") fout.write(code_str) fout.close() # execute the .py code … | |
![]() | Re: For wxPython you can use: Boa Constructor or wxGlade wxGlade comes as a tool with Stani's Python Editor (SPE), a very nice wxPython based IDE that can be downloaded from: [url]http://developer.berlios.de/project/showfiles.php?group_id=4161[/url] PyQT installs with a designer program that is pretty good I hear. |
Re: Wonderful project! Study C++ in detail and then move to GUI programming with C++. I expect your first game out in about five years. | |
Re: [QUOTE=andriod;895804]Well the book that I have is called "How to think like a Computer Scientist: Learning with Python" Printed in 2002. The version of Python on my computer is Python 3.0 IDLE(GUI). What version would you say the example that I posted from the book is in? Thank you[/QUOTE]If you … |
The End.