15,175 Topics

Member Avatar for
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
468
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
Member Avatar for skaliam

hi all, im new to python, and i have a problem that needs to be solved. i have the following set: [[5,5,5],[5,5,5,5,5],[]] which needs to end up being: [[5,5,5,5],[],[5,5,5,5]] has anyone got any suggestions?

Member Avatar for griswolf
0
102
Member Avatar for yeticannotski

Dear All, I am a total newbie to Python and programming in general. I know I'd find more materials for Python2, but Python3 was a reflected choice. That said, I have gone trough: [URL="http://www.daniweb.com/forums/thread173960-2.html"]http://www.daniweb.com/forums/thread173960-2.html[/URL] and tried to assemble my spell checker, and ended up with the following code: [CODE]#!/usr/bin/python3 # …

Member Avatar for yeticannotski
0
289
Member Avatar for woofers

I have written a client server program in which the server sends a program to the client, and the client executes the received program. In this case it is a line drawing program in OpenGL. The problem is that on running the server and client the whole program i.e. sending …

Member Avatar for woofers
0
142
Member Avatar for Evicake

Hello, I recently started writing a small program for reading multiple xls files from one directory. While reading one file like this,works perfectly: [CODE]wb = xlrd.open_workbook("C:\\path\\FileName.xls") sh = wb.sheet_by_index(0)[/CODE] this one doesn't: [CODE]os.chdir("C:\\path") for fileName in os.listdir("."): wb = xlrd.open_workbook(fileName) sh = wb.sheet_by_index(0)[/CODE] I keep getting the same error: [COLOR="Red"]XLRDError: …

Member Avatar for Evicake
0
373
Member Avatar for nima3188

Hi I want to write some variables into a file to be readable by excel. I used a loop like this to write the calculated "x" variable into the file. It works but the problem is that I get all the numbers in one line. I'm wondering how can I …

Member Avatar for nima3188
0
128
Member Avatar for Tommymac501

I have an app that allows my users to pop up a file of any size and look at the top 10 (or more) records, or, offset to any starting point and view a batch of records. I would like to put this app in some sort of Web page, …

0
54

The End.