14,947 Topics

Member Avatar for
Member Avatar for Smed

I want to print only a specified column of a 2D array. For example I can print a row [4,5,6] by doing: [icode] A=[[1,2,3],[4,5,6],[7,8,9]] Print A[1] [/icode] But I want to print the column [2,5,8] by doing something like: [icode] A=[[1,2,3],[4,5,6],[7,8,9]] Print A[][1] [/icode] Is there a way of doing …

Member Avatar for Gribouillis
0
79
Member Avatar for techie929
Member Avatar for Gribouillis
0
56
Member Avatar for KrazyKitsune

Is there a way to hide functions and such when they happen? Example: [code=syntax]print func(x, y)[/code] from showing up when you run it? I want it still printing, just not visible. I want it to print.

Member Avatar for griswolf
0
106
Member Avatar for Ultralisk

Here is my code, what I'm having problems with is taking values from a 10 field file (scores.dat) and putting them into a list. How would i go about this? [CODE]def main(): fileIn = open( "scores.dat", "r") lineIn = fileIn.readline() while len(lineIn) != 0: print lineIn lineIn = fileIn.readline() parse(lineIn) …

Member Avatar for TrustyTony
0
127
Member Avatar for nkinar

I have a string in Python that is comprised of code in C/C++ syntax. I would like to use regular expressions to search through this string and replace an expression of the form 'pow(a,b)' with 'a^b' I've attempted to do this, but my code does not seem to be working. …

Member Avatar for ptmcg
0
540
Member Avatar for c2q

Hi, Im currently taking an introductory course in python and i need help with some stuff. Basically for an assignment the first function we have is supposed to get an an average red value of all the pixels in the image. red being the R in (RGB). So basically the …

Member Avatar for woooee
0
170
Member Avatar for gatehrdy

[B]Hello, I am new to programming. I am trying to make a dice game called 10,000. Here is the outline or pseudo code. it kind of works. It will roll and keep score, but sometimes it will roll multiple times. [/B] pick a player player one or player two player …

Member Avatar for griswolf
0
946
Member Avatar for sixhobbits

Hi, I recently upgraded from python 2.6 to python 3.1 as I am writing some simple code which makes use of German special characters (äÄöÖüÜß). The special characters are in a dictionary. They are printed, but also input by the user. The program works fine now when run in Python …

0
32
Member Avatar for Macooper26

I just downloaded Python 2.7 and 3.2 and it just looks like DOS. I'm using Windows, so I don't know if that's the problem--because I saw someone using a MAC and it looked like they didn't have the same problems that I'm having--because I can't save and I have no …

Member Avatar for griswolf
0
83
Member Avatar for funfullson

hi dears. I have an unicode data in a file.it is a persian text. I want to read it and after some change write it in another file. but when I read it, I face to some hexadecimal characters. what I have to do with them? Thanks.

Member Avatar for griswolf
0
155
Member Avatar for mezz80

Assignment 1: Prompt the user to enter a number. After reading the user's input, print a 0 if the number is even or a 1 if the number is odd Assignment 2: Prompt the user to enter a number of seconds between 1 to 86,400. After reading the user's input …

Member Avatar for mjhurdle
-3
203
Member Avatar for novice20

hi all.. am working with python 2.4.1 n have pysnmp 4.1.14a installed.. the statement from pysnmp.entity.rfc3413.oneliner import cmdgen gives me the following error: ImportError: No module named pysnmp.entity.rfc3413.oneliner can anyone pls give me the reason? eagerly awaiting any response. Thanx in advance

Member Avatar for TrustyTony
0
2K
Member Avatar for danholding

[CODE]Traceback (most recent call last): File "C:\Documents and Settings\Administrator\My Documents\textprocessing\test files\keep 6 latest file.py", line 37, in <module> shutil.move(file_name, dst_file) File "C:\Python31\lib\shutil.py", line 278, in move copy2(src, real_dst) File "C:\Python31\lib\shutil.py", line 113, in copy2 copyfile(src, dst) File "C:\Python31\lib\shutil.py", line 66, in copyfile fsrc = open(src, 'rb') IOError: [Errno 2] No …

Member Avatar for danholding
0
402
Member Avatar for _neo_

Hi. I want to run some shell commands on linux machine with python Popen, for ex. "ping". How I can terminate the process, if it isn't finished normally in a given time? I've tried write some code, can anybody improve it or give some better idea? Any suggestions appreciated. Thanx. …

Member Avatar for Gribouillis
0
1K
Member Avatar for acrocephalus

Hello, I am trying to use icons on my "File" menu using this code [CODE]fileMenu = wx.Menu() log = wx.MenuItem(fileMenu, ID_LOG, '&Login\tCtrl+L') fileMenu.AppendItem(log) self.Bind(wx.EVT_MENU, self.OnLog, id=ID_LOG) NewUser = wx.MenuItem(fileMenu, ID_NEWUSER, '&New User\tCtrl+N') self.Bind(wx.EVT_MENU, self.NewUserDlg, id=ID_NEWUSER) fileMenu.AppendItem(NewUser) quitIcon = wx.ArtProvider.GetBitmap(wx.ART_QUIT, wx.ART_MENU, (16, 16)) quit = wx.MenuItem(fileMenu, 1, '&Quit\tCtrl+Q') quit.SetBitmap(quitIcon) fileMenu.AppendItem(quit) self.Bind(wx.EVT_MENU, …

Member Avatar for acrocephalus
0
107
Member Avatar for acrocephalus

Hello! I have a problem which I think it is related to Python, however I may be wrong. I am writing a database using wx.Python and MySQLdb. My problem is that when I want to send some string which contains accents to the MySQL database (for instance, 'Empordà') it is …

Member Avatar for acrocephalus
0
411
Member Avatar for acrocephalus

Hello! I am trying to set up a masked combobox using wx.lib.masked.combobox.BaseMaskedComboBox with autocompletion. However, I've found a couple of problems. On one hand, if I run the code as I provide it (code at the end of the post), I get an error caused by the 'Antigua and Bermuda' …

Member Avatar for acrocephalus
0
163
Member Avatar for Ashena

Hi everyone. I have two dictionaries. In dictionary1 I have numbers as keys and the occurrence of those numbers as values. In dictonary2 I have numbers again as keys, but there are more numbers here than in dictionary1. The values in dictionary2 are the description of the numbers. From dictionary1 …

Member Avatar for Ashena
0
103
Member Avatar for recyan

Hi, Am a total newbie to programming & trying to learn python thro pdf tutorials. I have this working code which uses four numbers as arguments to calculate the distance between 2 points. Tried to unsuccessfully convert it to use Class. Can some one guide me & can I request …

Member Avatar for recyan
0
2K
Member Avatar for omprakashrudhru

I have been using Pymssql to connect to MS SQL Server from Python. Currently I am not able to debug my python scripts due to a issue ("No buffer space available") in pymssql. I was also thinking of other options like using pyodbc. I need a good solution to connect …

0
61
Member Avatar for sss33

When you have a file with a lot of lines of numbers. I want to know if instead of writing the formula to calculate the numbers for everyline of data. Is there a way to tell it to apply the formula I have made to every line until there are …

Member Avatar for Gribouillis
0
95
Member Avatar for Ghostenshell

How would I pass something from a driver into a list inside a class. I then need remove a word from the list and replace it with a new word.

Member Avatar for griswolf
0
153
Member Avatar for lewashby

[CODE]background_image_filename = 'sushiplate.jpg' sprite_image_filename = 'fugu.png' # imports import pygame from pygame.locals import * from sys import exit from gameobjects import Vectory2 pygame.init() screen = pygame.display.set_mode((640, 480), 0, 32) background = pygame.image.load(background_image_filename).convert() sprite = pygame.image.load(sprite_image_filename).convert_alpha() clock = pygame.time.Clock() position = Vectory2(100.0, 100.0) speed = 250. heading = Vectory2 while True: …

0
69
Member Avatar for jayzee1989

So I have an assingment that I am stuck on -_- So I am supposed to create a code that "tests" out a range of integers and determine the perfect squares(4,16,25, etc) within the range without using square root calculations and using a function. I have written the following, and …

Member Avatar for TrustyTony
0
107
Member Avatar for JJHT7439

Alright, so for the lab I have to do using turtle in python I have to draw an H and then draw H's off of each end of the first H at a 45 degree angle and switch the color between blue and orange. The first H has to be …

Member Avatar for JJHT7439
0
105
Member Avatar for python_user

Hi Everybody, Can someone please tell me how to pass a frame to other class method I am able to pass the frame but when i pack some entry field..the window stops responding here is my code [CODE]class InfoFrame: def addAttributeCriteria(self, parent = None, type = '', attrib = {}, …

Member Avatar for TrustyTony
0
143
Member Avatar for sravi.pearl

hai i am new to python, can any one please help me how to parse data from an html file, i want to display the content which lies under a particular tag,and also can you please tell where can i find tutorials for this topic with sample examples.

Member Avatar for griswolf
0
244
Member Avatar for novice20

can anyone pls illustrate the use of snmpget in python, along with the explanation?? thanx in advance:)

0
70
Member Avatar for sss33

out = open ("output.jh") towrite= a+b out.write (towrite) When you want to put an output to a file. instead of the information going right next to eachother how could they go one over the other in the file. This would be for many different outputs.

Member Avatar for cghtkh
0
97
Member Avatar for janaka_17

i'm a new comer to this language. can anybody tell me why this simple piece of code gives me an error indicating that "NameError,name 'example' is not defined". by the way i use Wing IDE to write my codings. class example(): def _init_ (): print("a class is created") def m1 …

Member Avatar for woooee
0
84

The End.