15,181 Topics

Member Avatar for
Member Avatar for XLL

Hi all, can anyone help me with writting the code that does: [CODE] n=5 for i in range(0,n,1): answer=a*i #a is an array,say([2,3,4]) return answer [/CODE] basically I want compute a*i and return answers when i=0,1,2,3,4 ,and the answer should be a 3*n matrix, first row is when i=0, second …

Member Avatar for leegeorg07
0
74
Member Avatar for hockfan86

I have a couple of issues with my lab assignment for this week. I was wondering if you guys could help. I will post the assignment and then post my code thus far. Thank you. )Write a program that will display the menu below until user decide the quit the …

Member Avatar for hockfan86
0
119
Member Avatar for gunbuster363

I am using BeautifulSoup for my project and I don't know how the object returned by the Soup is organized, so I don't know how to access it, except using only print I can only do this: [CODE]link = soup.find(attrs={'class' : re.compile("util2$")}) print link [/CODE] it print out the whole …

Member Avatar for gunbuster363
0
2K
Member Avatar for jaymeaux77

Hi there, Im writing a program that takes a function and makes a plot of it. the program consists of 2 functions and each creates its own GraphWin. However i want to have a mouse click at the end close both windows. So i returned the window from the first …

Member Avatar for jaymeaux77
0
97
Member Avatar for lllllIllIlllI

Hi, Im using wxPython for my latest project and i was wondering, how do i make the window go to the best size, so it includes all of the objects on screen? I used to be able to remember... but i forgot :P

Member Avatar for lllllIllIlllI
0
84
Member Avatar for pythopian

PlugIns in their simplest form can be just python modules that are dropped into some designated directory and dynamically loaded by the main application. This snippet can be used to do just that. [B][U]Usage[/U][/B] To load plugin modules: [CODE]>>> plugins = importPluginModulesIn('mypackage') >>> plugins {'foo': <module 'foo' from 'mypackage\foo.py'>, 'bar': …

Member Avatar for pythopian
2
811
Member Avatar for relb.test

So here's the problem. I have sample.gz file which is roughly 60KB in size. I want to decompress the first 2000 bytes off this file. I am running into CRC check failed error cuz I guess the gzip CRC field appears at the end of file, and it requires the …

0
54
Member Avatar for lllllIllIlllI

Hi guys, Im a making a program where i need to be able to specify a folder and have my program import every module from that folder into my program... I was wondering how i would go about it. I can't use something like eval. But yeah, help would be …

Member Avatar for pythopian
0
14K
Member Avatar for leegeorg07

Hi I have this code currently: [code] dict = open("dict.txt", "r").readlines() print dict LETTERS={'a':1, 'b':2, 'c':3, 'd':4, 'e':5, 'f':6, 'g':7, 'h':8, 'i':9, 'j':10, 'k':11, 'l':12, 'm':13, 'n':14, 'o':15, 'p':16, 'q':17, 'r':18, 's':19, 't':20, 'u':21, 'v':22, 'w':23, 'x':24, 'y':25, 'z':26} word_value=0 lettersv=[] letterss=[] def main(): word=raw_input('what is the word?') word=word.lower() for …

Member Avatar for leegeorg07
0
113
Member Avatar for A_Dubbs

Hey guys, I was wondering if you could clear up some things on classes for me. I have had a semi-easy time understanding python and programming concepts up to this point but now am having a real tough time on classes. I think it is because my book uses long …

Member Avatar for bumsfeld
1
221
Member Avatar for sanchitgarg

suppose i have 10 different functions. i generate a random no. between 1 to 10. depending on its value i want to call the fucntion. eg. no. 3 call func, no. 8 calls func 8... etc. how do i do it using a loop without using the if else statement …

Member Avatar for sanchitgarg
0
243
Member Avatar for TheManual

I am trying to create a RPN calculator, the addition and subtraction functions work but it only accepts numbers under 10. How can I fix this so any integers are allowed? Thanks. [code] import sys accepted = '0123456789dr+-*/%^=' numbers = '0123456789' stack = [] while len(stack) <= 20: while True: …

Member Avatar for TheManual
0
91
Member Avatar for gunbuster363

Here is my code. If I use forloop to write, it got error: Traceback (most recent call last): File "m.py", line 20, in <module> f.write(tag[i].string) TypeError: argument 1 must be string or read-only character buffer, not None HOWEVER, if I don't use for loop, instead write as : f.write(tag[1].string) it …

Member Avatar for gunbuster363
0
149
Member Avatar for Mona1990

Hi I was wondering if someone could help me to figure out how to write a code for : Write a function print_table which consumes two parameters, a list of list of strings, and an integer for the length of the list. The function should print out the strings from …

Member Avatar for Mona1990
0
299
Member Avatar for mahela007

What would it take to make graphics show on the monitor without using stuff like tkinter and Qt? (tkinter and Qt are called toolkits right?)

Member Avatar for mahela007
0
255
Member Avatar for gunbuster363

I want to create a file and open it and write on it with f= open('out.txt', 'a') then it got error: File "m.py", line 10, in <module> f=open('./out.txt', 'a') IOError: [Errno 13] Permission denied: './out.txt' What happened?? I am using opensuse and was using a user account to edit and …

Member Avatar for gunbuster363
0
121
Member Avatar for leegeorg07

Hi I have been trying to use the python subprocess module but I find the documentation for 2.6.4 vague, does anyone else know of good tutorials for it? thanks in advance

Member Avatar for leegeorg07
0
92
Member Avatar for XLL

Hi all,I got a issue that how can I run several functions at same time? say [CODE] a=1 def function1(a) a+1 return a def function2(b) b+2 return b def plotGraph(a,b) return graph [/code] how can I just run plotGraph function here?..I am totally newb..hope anyone can help..thanks

Member Avatar for pythopian
0
112
Member Avatar for jex89

Hi, I don’t know if anyone would be able to help me with the following problem, I am hoping :D .. I have looked on the internet but no look. I have pickled a document into the pickle object, how can I now search the pickled object to remove a …

Member Avatar for pythopian
0
3K
Member Avatar for calccrypto

I wrote my own sha implementations but i cant get them to read files correctly. i know to use [CODE]open(file,'rb').read()[/CODE] as the input into the algorithm, but [CODE]import hashlib hashlib.sha1(open(file,'rb').read()).hexdigest()[/CODE] and my code [CODE]sha_1(open(file,'rb').read())[/CODE] return two different hashes. any idea why? i know that a normal string will have the …

Member Avatar for mn_kthompson
0
142
Member Avatar for jaison2

The function should ask the user for the price of the delivery and if the price is less than £10 then it should print a statement saying "the total price including the delivery charge is" + £1.50 or it should just output the normal price if it is more than …

Member Avatar for snippsat
0
219
Member Avatar for XLL

Hi all, I am a newb, got a simple question, anyone can give any idea about it will be great,thanks in advance. a=2 b=3 def functionA(a,b): c=a+b return c def functionB(c) answer=c+1 return c but this code doesnt work....what I want is just assign functionA as one of the argument …

Member Avatar for jlm699
0
79
Member Avatar for Garee

I'm having a little trouble with a piece of code im trying to write. I have created a deck of cards and then shuffled them however now I am trying to covert my deck (which is simply a list containing the numbers between 1 and 52) into the form "AS", …

Member Avatar for vegaseat
0
340
Member Avatar for zyrus001

I though it'll be interesting to look at threads and queues, so I've written 2 scripts, one will break a file up and encrypt each chunk in a thread, the other will do it sequentially. I'm still very new to python and don't really know why the treading script takes …

Member Avatar for Gribouillis
0
262
Member Avatar for sentinel123

Hello This is like my 4th week using Python and I'm still not familiar with it so I might need some help from you guys. I gotta write a little Connect 4 game in Python, I just got started and boom - I'm stuck! I tried to create a board …

Member Avatar for sentinel123
0
2K
Member Avatar for nirah_pooh

hi all May i know if anybody already use Clamwin binaries to develop an antivirus software? i need some ideas how to built clamwin binaries. All of the instruction given by I'm already followed [url]http://wiki.clamwin.com/index.php/Building_ClamWin[/url]. I got problem to make patch for wxPython. How to make a patch? From the …

Member Avatar for Gribouillis
0
170
Member Avatar for rbushlow

I have the following python code to access a MySQL database: [CODE] #!usr/bin/python # server_version.py - retrieve and display database server version import MySQLdb con = MySQLdb.connect (host = "localhost", user = "username", passwd = "password", db = "test") cursor = conn.cursor () cursor.execute ("SELECT VERSION()") row = cursor.fetchone () …

Member Avatar for rajasekhar1242
0
178
Member Avatar for james27

Hello all, im making some script with python mechanize, one of problem is it really hard to find which support javascript supported web client scraping or crawler. actually i was found some such as python-spidermonkey and pykhtml and so on. but most of all only support on linux . i …

0
63
Member Avatar for vansoking

[CODE]#! /usr/bin/env python #filename:pwd.py # development environment:python2.51 import getpass usr=getpass.getuser() while True: pwd=getpass.getpass("passwd:%s:" % usr) if pwd=='123': print "welcome to python!!!!" break else: print "The password you entered is incorrect" [/CODE]

Member Avatar for vansoking
1
394
Member Avatar for sanchitgarg

I have to write a code for generating random numbers without using random module and its function. How do I do it? I tried using the system time as it keeps on changing (importing milli seconds) but with tht I am able to get random nos in the range of …

Member Avatar for sanchitgarg
0
9K

The End.