15,181 Topics

Member Avatar for
Member Avatar for gunneronaspooky

Hey guys...Need some help with a program for class...here's the assignment If your program detects an error condition, you can make it raise an exception. Here is an example that gets input from the user and checks for the value 17. Assuming that 17 is not valid input for some …

Member Avatar for gunneronaspooky
0
177
Member Avatar for danholding

hey guys and girls i am having a bit of a problem with my code [CODE] import os,string,sys,pprint,time,glob from datetime import datetime, timedelta fileList = os.walk('.')#if i use glob.glob it does not show any files now = datetime.now() TWA = now + timedelta(days=-1) #print(TWA) files=str() for files in fileList: fileStats …

Member Avatar for griswolf
0
362
Member Avatar for rhuffman8

I am relatively new to Python and just have a couple quick questions about using file paths in Python code. 1) As I was recently playing around with the command line, I could not get a file path to work correctly unless I used forward slashes in the path...for example: …

Member Avatar for richieking
0
396
Member Avatar for sohel807

Why I have not seen any underline with the menu items although I have put "&" within the menu names. My code is as follows: [CODE]import wx import os class MainWindow(wx.Frame): def __init__(self, parent): self.dirname='' # A "-1" in the size parameter instructs wxWidgets to use the default size. # …

Member Avatar for richieking
0
276
Member Avatar for vbx_wx

[code] a = 10 def foo(x = a): print x a = 5 foo() [/code] Can someone explain why it prints 10 ?

Member Avatar for vbx_wx
0
98
Member Avatar for python3

Hey Guys, I have a minor problem with pytesser for the internet!!! I want to create a program that calculates equation from the internet. I need pytesser to recognize the equation and python to calculate it. Example: 5 + 5 = [ ] Then Sendkeys will type the answer in …

0
58
Member Avatar for br0wnm4n

I am trying to figure this problem out but I can't seem to get the code right. Please help. OUESTION: Implement a subclass of list called myList. It will behave just like the list class except for iteration: Usage: >>> l = myList([3,5,7,9]) >>> for item in l: print(item) 3 …

Member Avatar for griswolf
0
84
Member Avatar for novice20

hi... using pysnmp, an 'snmp get' varBinds gives me an 'octet string' of values like: 1+1 Protection; East-West; Spiral Search; ODU Enable/Disable I need to loop through these strings and see whether a particular string say, 'East-West' is present. I am not finding way to do this. can this octet …

Member Avatar for LoveMyPadres
0
2K
Member Avatar for Boubakr

Hi... I want ti contril the while loop, just make it looping just for x times, ex: loop for 5 times and pass to the next code :)

Member Avatar for -ordi-
0
88
Member Avatar for Brickmack

I've been trying to find information on this for a while, but I can't seem to find anything. I want to use python to send a command to the command prompt, then instead of sending the output to the console window, put the output into a variable that I can …

Member Avatar for richieking
0
172
Member Avatar for mossa

I've built a Counter (which is not implemented for python 2.6) for reading a sequence file of strings to a dictionary and trying to return those sequences are unique for that file/a number of files. I use sequences with a length of X-characters as key in my dictionary and put …

Member Avatar for richieking
0
284
Member Avatar for iwanttolearnc

hello there guys. im quite confused regarding the use of pyserial classes. ive been reading up on the pyserial documentation. i followed an example and used the code below [CODE]import serial ser = serial.Serial (0 , baudrate = 57600 , timeout = 1) #open serial port (1) - 1 line …

Member Avatar for iwanttolearnc
0
171
Member Avatar for felix001

Im pretty new to python so im still finding my feet.. Ive written a small ftp program that downloads a file but its quite basic in that it gets the last element from the list and then downloads it. What is the easiest way to add some logic so it …

Member Avatar for felix001
0
159
Member Avatar for Smed

Hi, I'd like to find the maximum value in a list but be able to state certain exceptions. For example: if list A=[1,5,3,4] I want to say [CODE]max(A) except index 1[/CODE] which would return '4' as the maximum value. Is there a way of doing this? Thanks.

Member Avatar for TrustyTony
0
123
Member Avatar for Tommymac501

When I execute; tkFileDialog.askopenfilename(title='Open file', filetypes=[('csv files', '*.csv')]) I get a file open dialog just fine, but there's also a blank TK panel about 2 inches square with nothing in it titled 'tk' behind the dialog. What is it, and how do I make it go away? I'm on Windows …

0
49
Member Avatar for hazyvisions

I can't get images to load.. I always get an error here's my code so far: #pong import os, sys import pygame from pygame.locals import * if not pygame.font: print "Warning, fonts disabled" #-------------------------------------------------------- def load_image(name, colorkey=None): fullname = os.path.join('data', name) try: image = pygame.image.load(fullname) except pygame.error, message: print 'Cannot …

Member Avatar for wanna_develop
0
168
Member Avatar for ShadyTyrant

How can I get my editor to expand both horizontal and vertical? I have a simple test application that uses a subclass of a StyledTextCtrl. I create my editor object in a subclass of wx.Frame. [CODE=python] def CreateEditor(self): myEditor = editor.SyntaxControl(self) # subclass of StyledTextCtrl sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(myEditor, 0, …

Member Avatar for ShadyTyrant
0
469
Member Avatar for sinisterduke

So i made a small game using pygame, and I want to be able to give it out to some friends who don't have python, so I want to make it into an EXE. i've been trying for several hours using several different methods, but nothings seems to be working. …

Member Avatar for tendragons
0
576
Member Avatar for CobRalf

Hello everybody!! I know that the topic "compiling python script" is a very popular topic, and there are informations about it everywhere on the net. I use windows and want to make a .exe-executable My problem: Everything I found... * is to old * does not work (exe has an …

Member Avatar for tendragons
0
371
Member Avatar for ilikepaste

import urllib.request page = urllib.request.urlopen("http://www.randompickupline.com/") text = page.read().decode("utf8") where = text.find('<p id="pickupline">') start_of_line = where + 18 end_of_line = start_of_line + 150 line = (text[start_of_line:end_of_line]) print (line) This is a basic html import for a text based game I'm writing for fun, and I'm making a dynamic string. However, the …

Member Avatar for ilikepaste
0
200
Member Avatar for rssk

hi all.......... 1)~ # free cat /proc/meminfo total used free shared buffers Mem: 62192 32080 30112 0 0 Swap: 0 0 0 Total: 62192 32080 30112 2)~ # free cat /proc/meminfo total used free shared buffers Mem: 62192 32440 29752 0 0 Swap: 0 0 0 Total: 62192 32440 29752 …

Member Avatar for rssk
0
119
Member Avatar for Boubakr

Hi... Let's say that we have this: [CODE]somme = raw_input('1 + 1 = ') if somme == 2: print 'Good - Time For Answer: ' else: print 'False - The Right Answer is: 2 -Time For Answer:'[/CODE] So... how can we get the time for writing any things on raw_input()

Member Avatar for richieking
0
166
Member Avatar for Boubakr

Hi... I want to start with PyQt and I don't from where should I beggin !! I'm using Fedora Linux 14 !

Member Avatar for Boubakr
0
74
Member Avatar for saransh60

plz see this code [icode] x=raw_input('enter any number :') def adder(d): d=d+1 adder(x) [/icode] in this function when x is passed to function adder ,,is 'x' and 'd' are copy of each other or d is reference of x..

Member Avatar for vegaseat
0
139
Member Avatar for Thropian

I'm looking for a way to get the first letter of of a string. I already know about the .startswith() but that is for "if" statements I want something like [CODE]print text.startswith() # to give me the left most symbol[/CODE]

Member Avatar for Thropian
0
279
Member Avatar for Enders_Game

If I have example code: [CODE]url = "someurl" values = {"username" : USERNAME, "password" : PASSWORD} data = urllib.parse.urlencode(values) req = urllib.request.Request(url, data) urllib.request.urlopen(req)[/CODE] it passes username and password to the url that you request. So I want to post a thread in a forum. When I look at the …

Member Avatar for snippsat
0
222
Member Avatar for meensatwork

Hello, Is it possible to use ctypes for this? I tried a sample code from net but it is not working. [CODE]from ctypes import cdll myDll = ctypes.LoadLibrary('C++dll.dll') mydll.testString()[/CODE] Can u tell me how to load a C++ dll and call the functions from python?

Member Avatar for TrustyTony
0
1K
Member Avatar for oooooops

I have been trying to learn Django (and Python). I have a form that can have up to [I]n[/I] elements. Each of those elements has 3 parts to it (a TextField, a TagField and a Checkbox). The form init looks like this [CODE] def __init__(self, *args, **kwargs): notesAndTags = kwargs.pop('notesAndTags') …

Member Avatar for richieking
0
459
Member Avatar for sravan953

Hey all, It's been a really really long time since I did any Python programming; upon the launch of the Web Store - I've been interested in developing a basic app myself. So here I am! Anyways, can anyone tell me if its possible to make a Packaged App using …

Member Avatar for Stefano Mtangoo
0
178
Member Avatar for vik.singh
Member Avatar for bumsfeld
0
152

The End.