14,946 Topics
|
|
I am having trouble with tkinter and python on my Mac, I'm running Leopard.I did a port install of python2.6, numpy, scipy, matplotlib, but when I try and import matplotlib.pyplot, I get the following error. I think there is a conflict with the pre-built version of python that comes with … |
|
i am getting a ValueError message when running my code i am currently converting from 2 to 3 and have come across a brick wall any help would be great :) [code=python] # sorts files by modifed date, collects the 6 most recent files, and delete all others. #created by … |
|
Hello, I'm trying to update a dictionary using variable in a class. Something looking like this : [code=python] class testClass(object): def __init__(self): self.data0 = 0 self.data1 = 1 self.data2 = 2 self.data3 = 3 self.d = dict( data0 = self.data0, data1 = self.data1, data2 = self.data2, data3 = self.data3 ) … |
|
I'm trying to make a siple list to display sqlite rows in a grid using wxList. I can't come up with something decent. I can't place correctly the items in the list. [code] #!/usr/bin/env python # -*- coding: utf-8 -*- # generated by wxGlade HG on Wed Sep 22 12:34:17 … |
|
Let's create a continuing thread to program Crazy 8's from scratch for learning purposes! [B]DECK/CARD IDEA'S[/B] My simple starting suggestion: [CODE]deck = ['2C','3C','4C','5C','6C','7C','8C','9C','10C','JC','QC','KC','AC', '2D','3D','4D','5D','6D','7D','8D','9D','10D','JD','QD','KD','AD', '2H','3H','4H','5H','6H','7H','8H','9H','10H','JH','QH','KH','AH', '2S','3S','4S','5S','6S','7S','8S','9S','10S','JS','QS','KS','AS',][/CODE] |
|
So I'm trying to make a parser for a game replay. I just need help getting started, I have docs for it explaining. Atm I'm just trying to get the header parsed. [code] replay = open(r'C:\Users\CookieMonster\Desktop\mix.w3g', 'rb') #offset | size | description print(replay.read(0x1c)) #0x0000 | 28 chars | zero terminated … |
|
I've been trying to modify a function and every attempt seem to screw up the plist. [CODE]def removeItem(pl, item_name): for dock_item in pl['persistent-apps']: if dock_item['tile-data']['file-label'] == item_name: verboseOutput('found', item_name) pl['persistent-apps'].remove(dock_item) return True for dock_item in pl['persistent-others']: if dock_item['tile-data']['file-label'] == item_name: verboseOutput('found', item_name) pl['persistent-others'].remove(dock_item) return True return False [/CODE] This scans … |
|
Hi everyone, Does anyone know how to remove a particular attribute in XML by using Python? [CODE] <country> <city capital="Paris">Paris</city> ............ ............ </country> <country> <city capital="Helsinki">Helsinki</city> ............ ............ </country> <country> <city capital="Bogota">Bogota</city> ............ ............ </country> [/CODE] I just wanna delete or remove Paris and Helsinki here by using SAX or … |
|
Hello! I have a frame with some sizers in it (see code at th end for a running example). I would like to know how to repeat the sizers 2, 3 and 4 when pressing the add button. The sizers should be added before the submit button, and the control … |
|
hello! I'm coding in python and have make the computer controll a lego NXT robot via bluetooth. Next step is to involve my lg ku990 mobile to the network, so I can get the camera and sound information from the mobile phone. Do anyone knows a python library as allow … |
|
[CODE]paid_value = self.paidinput.GetValue().strip()[/CODE] I have this line of code to take a number from the paidinput field, but i need the value as an integer, how would i go about this? |
|
Hello Daniweb, I would like to read binary data into floating point numbers. I'd be happy with a 1-D array (or vector) or a 2-D array. Just something I can write to a text file. I attached a small sample of this data. Here is the code I have so … |
|
Hi, Given a sentence, I'm trying to check if all the individual constituents of a word are present in it and if they are then do some further processing. I can't seem to get the logic to work. [CODE]wordlist = ['England area','Germanic 6th'] mysentence = 'The area now called England … |
|
Hi, My requirement is to identify '-' in string1 and delete those corresponding locations in string2. The logic I am implementing is that 1. find the locations in string1 where '-' occurs 2. At these locations, insert spaces in string2 and then 3. have string2 without spaces. I managed to … |
|
Hi I recently started using python for work and was tasked with creating a mailer script for one of our linux servers. I found a number of good examples on the web for different mailer app implementations and eventually came to the code below. Can anyone advise me on good … |
|
Hey I'm new to the site but I'm taking a class that will probably have me here often asking stupid questions. One of my homework problems is create a python program using a while loop to answer the 100 fowl problem. The 100 fowl problem is a farmer sold 100 … |
|
Dear all. I have a file with lines like this.[CODE] query 210 ACTTGGACTC 219 query 311 ACTTGGACTC 320 ....[/CODE] From every line, I need to extract the number coming right after 'query' and then the DNA sequence. I currently read each line as a list but was only able to … |
|
Is it possible in python to open all files in a directory? this only opens a particular file: [CODE]import os path = "/Desktop/directory/file.odt" temp = os.system("open " + path)[/CODE] how about this? am i doing it right? [CODE]import os mypath = "/Desktop/directory" temp = os.listdir(mypath) temp = [os.path.join(mypath, i) for … |
|
[CODE]import os from appscript import * this = app(u'System Events').application_processes[param1].windows[param2].exists() while True: this1 = app(u'System Events').application_processes[param1].windows[param2].count(each=k.radio_button) if count == (this1): this2 = app(u'System Events').application_processes[param1].windows[param2].radio_buttons[param3].click() try: os.makedirs(param1) except OSError: if os.path.exists(param1): this3 = os.system('screencapture -C '+ param1 +'/'+ param2) while True: self.param2 = os.path.join(param1, 'win%s_%s_img_%s' % (param1, param2)) return param2 + … |
|
I've created a program with turtle graphics that has 3 functions. One draws rectangles, one draws squares and one sets the position. I'd like to create a function that fills in the shapes with different colours. I know about begin fill and end fill... but I would really like to … |
|
f i opened a document in terminal through this [CODE]os.system("open " + pathName)[/CODE] how should i close it? is there something like [CODE]os.system("exit")[/CODE] or something Thanks |
|
Hi Guys i have a situation where i need to have a options menu kind of thing. When they select some option in the menu i need to have a text-box/box which accepts only date/box which accepts only int beside it to accept the value I am trying to do … |
|
I am brand-new to Python, and this is my first post on DaniWeb. Seems like a positive community, and I hope one day to contribute as a knowledgable expert and not a world-class newbie. I'm wanting to create a simple python program that "fakes" Shakespeare or haiku-style output. I realize … |
|
Is there a way to set an objects id or memory position? Ultimately I'm trying to change function "a" to function "b" while still preserving any saved reference to function "a" |
|
Is there a logical operator in python for and/or of strings? I am trying to write a weasel code. What I have so far: [CODE]import random import math keys='abcdefghijklmnopqrstuvwxyz ' monkey='methinks it is like a weasel' def attempt(): attempt='' for i in range(len(monkey)): x=random.choice(keys) attempt+=x return(attempt) library_attempts=[] for i in … |
|
Hi there. I am trying write a module that can be executed at the command line and for some reason it's not working. Does anyone know why? [CODE]import sys def fibonacci(N): a,b =0,1 while b < N: a,b = b, a+b print b N=sys.argv[1][/CODE] Does it matter that I'm running … |
|
Dear All I am working with a tab-delimeted files - first two columns are pairs of identifiers and third column is floating point number (0-1) denoting interaction strength between colmn1 and 2. sample file is also attached. eg- column1 column2 column3 john steve 0.67588 john matt 1.00 red blue 0.90 … |
|
could anyone help me regarding calling different python scripts from within a main script.How can this be acheived? Thanks in advance |
|
for: [CODE]import random keys='abcdefghijklmnopqrstuvwxyz ' random.choice(keys)[/CODE] How would I count how many times it takes random.choices(keys) to generate "m"? |
|
Here's a weird one: I have a Tkinter.Text widget that I import data from with inputText.get(1.0,END) However, later in the program I have the text in an array, but the array has values like: 'u\x00s\x00e\x00r\x00' Is there a way to decode this weird string to a normal string? I think … |
The End.