15,190 Topics

Member Avatar for
Member Avatar for macca21

I need this program to buy and sell items from a list. the list needs to display similar to below and have a menu for user to select options from: ID No. Name Price Stock 1 Apples $2.50 4 Choice: Buy - 1 Sell - 2 Quit - 0 *Needs …

Member Avatar for macca21
0
95
Member Avatar for sarfrazashfaq

Hi there I have following XML document that i want to read in python code. i know how to read, thing is i want to make hash/list from this XML document. <?xml version="1.0" ?> ‐<TradeExt> ‐ <fxall category="buyer" version="2.0"> ‐<tradeHeader> <sourceId>test_sourceId1</sourceId> <pmsId>4521363.0.0</pmsId> <fundId>ACCT1@TESTCUST</fundId> </tradeHeader> ‐ <tradeStatus> <dealImmediately>F</dealImmediately> <blockImmediately>F</blockImmediately> </tradeStatus> ‐ …

Member Avatar for ultimatebuster
0
352
Member Avatar for cableguy31

I'm trying to write a script that will go to a host and list all of its shares. So far, in my searching, it seems that I need to include a top level share name. For example: [CODE]os.listdir('\\\\1.2.3.4\')[/CODE] doesn't seem to work, but [CODE]os.listdir('\\\\1.2.3.4\\share\')[/CODE] will work. As a bit of …

Member Avatar for TrustyTony
0
400
Member Avatar for redyugi

Lets say I have a class. It holds other classes in it. ex [CODE]class Test: def__init__(self, name): self.name = name def getname(self): print(self.name) class Holder: def __init__(self, tests): self.tests = tests def getnames(self): for i in self.tests: print( i.getname())[/CODE] so lets say I pickle an instance of Holder with 3 …

Member Avatar for redyugi
0
115
Member Avatar for macca21

how do I save a dictionary, (below), to a txt file thats is in a tabular format? i also need to be able to rload the txt file back into its dictionary form... catalog = { 1:["Bread", 1.50, 10 ], 2:["Cheese", 5.00, 5], 3:["Apples", 2.50,12] } eg. 1 Bread 1.50 …

Member Avatar for vegaseat
0
137
Member Avatar for macca21

Can someone please show me how to implement the pickle module in this pogram!? PLS? I've tried for hours but I think programs are immune to my trying! Thnx [CODE]'''maintain a catalog''' def main(): global catalog loadCatalog() while True: pick = showMenu() if pick == 0: break elif pick == …

Member Avatar for vegaseat
0
59
Member Avatar for docesam

python is not a new programming language ,it has been there for the last .... 15+ years or so ? right ? now , by having a look at this page [url]http://wiki.python.org/moin/Applications[/url] i can see only few programs written in python .i tried some of the programs in that list …

Member Avatar for TrustyTony
-4
326
Member Avatar for Kruptein

I have this wx.ListCtrl and I want to get the "Variable" name and the "Value" name, but I can only get the "Variable" name, how to get the second? [code=python]def __init__(...): ... self.list_ctrl_1.InsertColumn(0, 'Variable') self.list_ctrl_1.InsertColumn(1, 'Value') self.list_ctrl_1.SetColumnWidth(0, 200) self.list_ctrl_1.SetColumnWidth(1, 200) for item in ls: self.list_ctrl_1.Append((item[0],item[1])) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.dclick) def dclick(self, event): …

0
69
Member Avatar for prashanth s j

Hi all, I need to initialize an array iteratively. For example array my_arryay needs to initialized with 512 characters and next with 1024 characters and next with 2048 characters etc etc, which can only be iteratively. Something as in C: for( i = 0; i<100:i++) { my_array[i] = 'a'; } …

Member Avatar for prashanth s j
0
235
Member Avatar for prashanth s j

Hi all, I have got several python scripts and I need to run them in one shot. So I assume that in a .py file I can give statements ./file1.py ./file2.py ./file3.py etc to run multiple scripts. I am defining global variables in a config.py file and these will be …

Member Avatar for prashanth s j
0
2K
Member Avatar for prashanth s j

Hi all, I have got several python scripts and I need to run them in one shot. So I assume that in a .py file I can give statements ./file1.py ./file2.py ./file3.py etc to run multiple scripts. I am defining global variables in a config.py file and these will be …

Member Avatar for prashanth s j
0
122
Member Avatar for niehaoma

So, I am learning Python. To help my understanding, I was wondering how someone might make this code more efficient. Purpose: Take a 32-bit value (tempCode) and output each nibble. My way was to use a string, basically shifting out the binary value from bit 0 to bit 31 into …

Member Avatar for niehaoma
0
269
Member Avatar for chase32

There is a table that I need to access using pyodbc that contains numeric descriptions for some of the columns and I cant seem to figure out how to get to them by name. for example, this works great for pulling the column called 'Category' [code=python] cursor.execute("exec blablabla") for row …

0
45
Member Avatar for gorbulas

Hello I made a program that submits a paragraph to a webpage, using mechanize. Its all working great, except when I view the paragraph, all the newlines have disappeared and it makes all the paragraphs all block up together into one long sentence. But when I open up the page …

Member Avatar for gorbulas
0
95
Member Avatar for jib
Member Avatar for jib
1
4K
Member Avatar for zenith_96

heya guys - new to posting here, but i have browsed the forums for help over this year so far. obvisoulsy im also new to python, only trying it since march. Im trying to write some code for a 'knock knock' program. It uses a txt file for the jokes, …

Member Avatar for zenith_96
0
197
Member Avatar for persianprez

Not really sure what a command line argument is, but here is an example question that I don't understand: "Write a program that gets 4 integers as command-line arguments, prints the values and their total." Can somebody show me how to do this? I have like 10 of these to …

Member Avatar for ultimatebuster
0
153
Member Avatar for persianprez

I was able to finish some: [CODE]def sieve( n, primes): numbers =[] # make a list of integers from 0 to n, inclusive for i in range(2, n+1): numbers.append( i ) # by definition, the first prime is 2 del(numbers[ _____________ ]) del(numbers[ _____________ ]) # while there are still …

0
53
Member Avatar for Stefano Mtangoo

Hi guys, I have been away Python for long now. I need to brush with small project that will be downloading images from give url. I give url and it crawls through all pages in give location and its subfolders and download image. Now two challenges: 1. Crawl through all …

Member Avatar for Tech B
0
194
Member Avatar for macca21

Here's a question from my assignment, I need HELP! i'm after a basic structure of code that I can work from. pls try explain steps in code. THANX Create an application that utilizes your Order class to implement a simple Order tracking system. To do this your system must be …

Member Avatar for woooee
0
92
Member Avatar for G-nom

Hello In my program i have a matrix the code for which is [CODE] test = [ ["x" for x in range(5)] for y in range (5) ] for y in test: print " ".join(map(str,y))[/CODE] which prints something like: x x x x x x x x x x x …

Member Avatar for woooee
0
111
Member Avatar for tomtetlaw

Does anyone know about any companies, however big or small use python in any part of their game programing? I'v looked around the web to try and find some but i cant seem to find any, any help would be apreciated.

Member Avatar for jib
0
37
Member Avatar for Steven.T

Write a spell checking tool that will identify all misspelled word in a text file using a provided dictionary. The program will accept either one or two command line parameters. 1. The first command line parameter is the name of the text file that will be checked. 2. The optional …

Member Avatar for TrustyTony
0
1K
Member Avatar for jib
Member Avatar for macca21

OK, how do I make this program allow the user to modify the price of items and save and load the modified catalog? i've spent ages trying and failing. pls help! [CODE]'''maintain a catalog''' def main(): global catalog loadCatalog() while True: pick = showMenu() if pick == 0: break elif …

Member Avatar for Lizzard013
0
90
Member Avatar for miklamer

Hello everyone! I have a problem so i want to ask how to do that. I'm goint to write program for form fill. step by step: 1- login 2- fill form 'hostname' (then submit) 3- fill form ip/log/pass/description (then submit) 4- read web. if there is a problem refresh site …

0
43
Member Avatar for oaktrees

I have the following code, [code] import csv w=csv.writer(file('newfile.csv','wb'),dialect='excel') some_values=[[1,2,3],['A','B','C'],[4,'"5"','ab,c']] w.writerows(some_values) [/code] When I run it on my computer (a mac), newfile.csv is created. However, when I open newfile.csv, it is empty. Any ideas why?

Member Avatar for oaktrees
0
2K
Member Avatar for mysticstylez

Hi, So, i have a list that contains some words. I need to read a text file and cross reference it with each word in the list. if that word occurs in the text file, i need to filter it out with "*". How would i go about doing that. …

Member Avatar for griswolf
0
3K
Member Avatar for jib

[B][COLOR="Green"][B]I have done the blackjack program but every time i run it shows an error here is the code: P.S. I also need to show the value of the card[names of the cards e.g Jack etc[/B][/COLOR][/B] [CODE]import random as r def define_cards(c): rank_suit=["ace","two","three","four","five","six","seven","eight","nine","ten","jack","queen","king"] suit_rank=["clubs","spades","heatrts","diamonds"] for suit in range(4): for rank …

Member Avatar for jib
1
106
Member Avatar for rickymak

def info(object, spacing=10, collapse=1): """print methods and doc strings. Take module, class, list, dictionary, or string.""" methodList = [method for method in dir(object) if callable(getattr(object, method))] processFunc = collapse and (lambda s: " ".join(s.split())) or (lambda s: s) print [B][U]"\n".join(["%s %s" %[/U][/B] (method.1just(spacing), processFunc(str(getattr(object, method).__doc__))) for method in methodList]) if …

Member Avatar for d5e5
0
732

The End.