15,194 Topics

Member Avatar for
Member Avatar for Skrutten

I'm trying to use my methods, but i always get " <bound method Deltagare.tavla of <__main__.Deltagare instance at 0xfba58>>" what does it mean? is something wrong with my class?

Member Avatar for hondros
0
104
Member Avatar for faded jeans
Member Avatar for lrh9
-2
64
Member Avatar for mahela007
Member Avatar for RogerI

I need to read in a large amount of data from a csv file into arrays. I am using Numpy as I need to later manipulate and plot the results. I have decided to use numpy.loadtxt as this appears to be the most efficient method to read in the data. …

Member Avatar for RogerI
0
2K
Member Avatar for checker

[CODE]class Database(Student): def __init__(self): g = [] choice = ['Basketball','Football','Other','Baseball','Handball','Soccer','Volleyball','I do not like sport'] data = student.sport k = len(student.fname) print k freq = {} for i in data: freq[i] = freq.get(i, 0) + 1 for i in choice: if i not in freq: freq[i] = 0 for i in …

Member Avatar for checker
0
207
Member Avatar for SoulMazer

Okay, well I've been looking for at least an hour now for some straight-forward python-xlib documentation, and I have been unable to find any. Luckily...I have quite the easy problem. If somebody would be able to help me create a simple script that would say "Hello" every time the left …

Member Avatar for SoulMazer
0
584
Member Avatar for ahspats

How could one find the length of longest row of same elements in a list. For example if i have a list list = [0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1] and i …

Member Avatar for woooee
0
145
Member Avatar for takarii

Ive written a program to do with drawing a line from a centre point and it is meant to snake randomly from the centre. However, it seems to be incredibly biased as to where it decides to go. the 4 directions are as simple as up down left and right, …

Member Avatar for takarii
0
121
Member Avatar for ffs82defxp

I don't understand what those two things do and how they work i tried researching off google, but i couldnt get a direct answer

Member Avatar for vegaseat
0
777
Member Avatar for ribot

Hi! I'm trying to combine some frames in a GUI as a toolbar and content area. Currently I'm on windows and using python 3, and I want preferrably my app to work on *nix and mac as well. The problem is that in the following app, when I resize it …

Member Avatar for ribot
0
2K
Member Avatar for qq263020776

A building has three elevators, 16-storey level. Write a program to simulate the operation of elevators. Requirements: 1. At the highest level can only be a downward trend, the lowest level can only be upward, the middle layer can be by any upward and downward; 2. Each layer is only …

Member Avatar for vegaseat
-3
1K
Member Avatar for jwxie

[CODE]import csv class Reader(object): def __init__(self): self.names = [] self.idigit = [] self.fileReader_list=[] self.fileReader = csv.reader(open("survey_result.csv", "rb")) self.fileReader_list.extend(self.fileReader) for column in self.fileReader_list: self.names.append(column[1]) self.idigit.append(column[2]) del self.names[0] del self.idigit[0] X = Reader() for i, names in enumerate(X.names): print names, X.idigit[i][/CODE] Ch, Sbb 6748 Oudfd, Sufdfdfy 8473 Sdfdfu, Radfdf 5667 Adfn, Mudfmmdfd …

Member Avatar for snippsat
0
154
Member Avatar for pluring

Hi! I need to split a list if item A is followed by item B. I'm really stuck at this and the only thing i could think of is that i should use regex, but i dont know how. Example of list: list = ['email@email.com', 'email@email.com', 'email@email.com', 'REF123', 'REF123', 'email@email.com', …

Member Avatar for Namibnat
0
110
Member Avatar for i are smart

i just started learning GUI, and i made my first graphic interface using the tkinter module, but as information is piled up and goes beyond the window's dimensions, i need those scroll bars to up and down

Member Avatar for woooee
0
102
Member Avatar for i are smart
Member Avatar for ffs82defxp

I noticed that when i posted programs on here people gave me their versions, and had [CODE] import * def somethng_here(): while True: Try: pass except ValueError #or some other types of things liek that [/CODE] I don't understand how a function can be FALSE, as well as how these …

Member Avatar for vegaseat
0
332
Member Avatar for lrh9

Lately I've been writing a lot of code involving the creation of new objects, and I quickly come to find that Python almost always creates a reference to an object instead of a new object. I understand the importance of conserving memory usage, but in this instance I actually need …

Member Avatar for lrh9
0
190
Member Avatar for lidyaMikhail

hello i have a python chat server (multi client) and i wanted to connect a java client to it but i have been searching alot about java-python connection and i got solutions like using APIs as YAML or SOAP but i just can't figure out which one or if there's …

0
53
Member Avatar for MRWIGGLES

can anyone help me determine it? from the looks of pages on google. it's just a bunch of 90 degree angles that are constantly rotated 45 degrees about it's axis. thanks.

Member Avatar for vegaseat
0
1K
Member Avatar for newtri13

I have a small script that connects using ssh and opens a tunnel on port 3306. It works in the ipython interpreter if i type it in manually. However when I try to run the script from the interpreter or command line I get the error message "Can't connect to …

Member Avatar for newtri13
0
186
Member Avatar for hondros

Okay, this is what I am trying to do. I am attempting to create my own encrypter. I have the base encryption running, used just to encrypt a string you put in. I am going to add functionality to open a text file's contents and encrypt them, outputing them into …

Member Avatar for vegaseat
0
166
Member Avatar for goisagi

So my listname is men =[] How can i print just the 10 first elements of the list? It contains 15... And it's a matrix... I thought about making a while-loop while i > 9: but it didn't work. Can anybody help me please? :)[code]for gender in men: print gender[0] …

Member Avatar for goisagi
0
99
Member Avatar for El Duke

I can't believe I am getting this error again and again .... Here is my class: [CODE]class LANGUAGE: def __init__(self, val): self.val = val def Set(self): return self.val [/CODE] Here is the function call: [CODE]if text in translate._languages: msg = "You have chosen the " + translate._languages[text] global NewLang newlang …

Member Avatar for El Duke
0
680
Member Avatar for aditri

i try to connect python to internet but can't Error 407 Proxy authentication required Is there someone who can help thank -

0
41
Member Avatar for jwxie

[CODE] # This is my second attempt writting a class class Getlist(object): def __init__(self,list1=[],list2=[]): self.list1 = list1 self.list2 = list2 def printIt(self): print self.list1 print self.list2 # This will combine the two lists together class combineList(Getlist): def __init__(self): for i in range(len(getlist.list1)): print getlist.list1[i],getlist.list2[i] getlist = Getlist([1,2,3],['a','b','c']) getlist.printIt() combineList = …

Member Avatar for jwxie
0
134
Member Avatar for ffs82defxp

It won't work! [CODE]def get_user_choice(): from string import digits user_choice = input('Type a number, 1 to 6.\n\n') if user_choice == '': print 'Not a valid choice.' raw_input() main() check_if_true(user_choice) def check_if_true(): import random comp_choice = random.randint(1,6) if comp_choice != userchoice: print 'The computer won :(' return comp_choice, user_choice else: print …

Member Avatar for ffs82defxp
0
113
Member Avatar for Nazere

hey guyz, i need to make a code for searching the names in the list txt. i pretty much got the other parts, but when im kinda stuck on searching. [CODE] def main(): list_of_names = open_file() print""" --------------- non sorted---------------------""" print_names(list_of_names) print """ ----------------sorted-------------------------""" list_of_names = sort_names(list_of_names) save_file(list_of_names) search_names(list_of_names) def …

Member Avatar for vegaseat
0
113
Member Avatar for JuvenileMango

Hi, I'm trying to write a hangman game program, but some things aren't working properly. [CODE]def hangman(): choice=input("Enter a letter: ") a=type.find(str(choice)) if len(choice)>1: print ("Only one letter please") hangman() elif a!=-1: b[a]=str(choice) print ("Correct") c=''.join(b) print (c) if type==c: print ("WINNAR!") else: hangman() else: d+=1 e[d]=choice if d==0: print …

Member Avatar for JuvenileMango
0
178
Member Avatar for python.noob

Hi everybody, I just started learning pyqt.. I referred it's wiki page and found some but only two links are useful.. I finished pyqt tutorial in zetcode.. It was really good.. I've downloaded cross-platform GUI programming with pyqt book.. But it's not an ideal book to start with for the …

Member Avatar for vegaseat
0
161
Member Avatar for Kippstah

Ok, uhh... I need help. My loop to keep the program running or to quit isn't working right. Can somebody help me figure it out? I tried a couple of methods, and they didn't work. Do anybody have any idea? By the way, this is for a blood drive program …

Member Avatar for Kippstah
0
1K
Member Avatar for basti!

Hello together, sorry for my bad english. I'm complete new to python and its very difficult for me, so i hope that you can help me. i have got a csv in which there are names and telephone numbers. Now i have to do an program that shows me the …

Member Avatar for vegaseat
0
119
Member Avatar for lewashby

In the following program, I have three different comments each after a line of code. Please read those comments to answer my questions. [CODE] # Property Critter # Demonstrates get and set methods and properties class Critter(object): """A virtual pet""" def __init__(self, name): print "A new critter has been born!" …

Member Avatar for lrh9
0
263
Member Avatar for jmark13

I have some cnf files, which are txt files that are in a specific format for conjunctive normal form formulas. I want to take this file, which looks something like this: c The random seed used to shuffle this instance was seed=1755086696 p cnf 1200 4919 -35 491 -1180 0 …

Member Avatar for jmark13
0
4K
Member Avatar for sanitizer

System: Xubuntu, Karmic 9.10 Compiler: gcc Python: python2.6 IDE: CODE::BLOCKS Trying the following example: #include "Python.h" void initxyzzy(void); /* Forward */ int main(int argc, char **argv) { /* Pass argv[0] to the Python interpreter */ Py_SetProgramName(argv[0]); /* Initialize the Python interpreter. Required. */ Py_Initialize(); /* Add a static module */ …

Member Avatar for Gribouillis
0
731
Member Avatar for Namibnat

[COLOR="Red"]Note two things: First off, I don't guarantee that it works well. Writing to files, if done wrong can always break things. Be careful. I mostly participate in this forum (the Python part) for fun, and my code is written like that. Second: this script is about copying things. I …

Member Avatar for Namibnat
1
820
Member Avatar for rmatelot

Extract Blocks of Info from Log File New learner..this would be my first try at writing in Python that I can actually put to use: Have log file content that looks like [URL="http://i.imgur.com/RcU3J.jpg"]this[/URL] Basically - I only want to keep "slots" with the indicator "[COLOR="Red"]/* mysql */[/COLOR]" - the blocks …

Member Avatar for Namibnat
0
2K
Member Avatar for jwxie

Hi, my professor is asking a project. Overview: Get x number of students for a simple survey. Make a data analysis, including [1] name [2] gender [3] ID [4] Question 1 and data analysis - probability - % - distribution In this project, each student is an "object" I am …

Member Avatar for jwxie
0
111
Member Avatar for Elvedon

Thanks for your input vegaseat. I have posted the code that is giving me the problem in the two scripts and I hope you can comment further. Thanks in advance - Elvedon. [CODE]#The script displayed below is only part of the larger original script.# #filename = 'firstScript.py' #!/usr/bin/python from Tkinter …

Member Avatar for vegaseat
0
713
Member Avatar for pysup

Hi, I need to login to a site, make some changes and then there is an apply button which i need to click to save the changes. The HTML code is as below for the buttons [ICODE]<input type="button" onclick="clickApply()" alt="Apply" value="Apply " class="button" name="applybutton" id="postApply"/>[/ICODE] I am able to login …

Member Avatar for ruandejun
0
2K
Member Avatar for n00bprogrammer

Hello, I'm fairly new to programming, and am working on a project for a programming class. I've run into a problem, and need some help... I'm writing a hangman game and I'm having trouble getting the guessed letter to replace the correct hidden letter. Say the word is DICTIONARY, if …

Member Avatar for Namibnat
0
78
Member Avatar for lewashby

In the following program, the second line in main print [COLOR="Red"]"Printing a Card object:"[/COLOR], is not showing up when I run the program. Could someone please tell me what's going on? Thanks. [CODE]# Playing Cards # Demonstrates combining objects class Card(object): """ A playing card. """ RANKS = ["A", "2", …

Member Avatar for snippsat
0
123
Member Avatar for alokjadhav

I am using SWIG to extend Python to C++. Understand that there is a different forum for SWIG users but I am still waiting for a response on that list. But the questions I have consists of basic Python C API releated. I hope this list will be able to …

Member Avatar for alokjadhav
0
729
Member Avatar for fummy

[CODE]import re, os ...from os.path import join as pjoin, isdir ...targetdir = raw_input('c:\volatility-1.3_Beta>c:\python26\) ...os.chdir(targetdir) ...if targetdir = raw_input ...then exec ('python.exe volatility pslist -f c:\python26\nick.img')[/CODE] ************************** Can you help please... Trying to run this program to execute the currently runing processes on the \nick.img... that I capture... program not working... …

0
71
Member Avatar for fummy

Can someone help please! I need to search for a different set of strings like: 'fummy' or 'users' or 'logon' from a directory like this: C:\mycase\Nic..\ A Text document is stored in there LIKE: 544, Text Document, 45, 588 KB Can some help to write a script or python program …

Member Avatar for Murtan
0
187
Member Avatar for Kippstah

Ok. So. Who doesn't know how to convert on paper or in their head decimal numbers ==» binary number, or vise-versa? Well. I've successfully programmed a conversion calculator for those who just never took the time to learn, for those who don't care to learn, and for those who've got …

Member Avatar for Kippstah
0
1K
Member Avatar for Yeen

I've been trying to figure out how to capitalize all the sentences in a string. In the string [CODE]a = "this is the test string! will it work? let's find out. it should work! or should it? oh yes. indeed." [/CODE] I want all the characters after [I]". " "! …

Member Avatar for Yeen
0
1K
Member Avatar for vegaseat

Here we apply the module difflib to compare two texts line by line and show the lines of the first text that are different from the second text.

Member Avatar for jimothy
0
236
Member Avatar for checker

[CODE]element = {'H': 1, 'N': 6, 'F': 7, 'Cl': 7} i = input("Enter: ") dots = '*' totalDots = (dots * i)[/CODE] Enter: H Traceback (most recent call last): File "D:/Python26/lewisdot.py", line 4, in <module> i = input("Enter: ") File "<string>", line 1, in <module> NameError: name 'H' is not …

Member Avatar for jimothy
0
147
Member Avatar for vikramsra

Hi, i am new to python world my problem is that i am getting a output file from a software which is very messy first i just want to delete first 3 rows and the columns F onwards from the excel file and that i just want to change the …

Member Avatar for vikramsra
0
204
Member Avatar for lisedaton

hi everybody!!! I will really appreciate if somebody could help me.... we are working with c and python and the same time and it gets confusing sometimes... I need to write a program in python tha will receive a string and it will print only the number in the string …

Member Avatar for Namibnat
0
92

The End.