15,175 Topics

Member Avatar for
Member Avatar for kishoreinme

hello there Iam using python 2.5.4 pyserial 2.4 pywin32-214 on windows 7 i hav a small test script written to query a serial device (arduino) and get back reply appropriately ////file: test.py import serial print 'hi' ser=serial.Serial(port='\\.\COM2', baudrate=9600) ser.close() ser.open() ser.write('1') ser.readline() ser.readline() ser.close() the device waits for '1' through …

Member Avatar for Tech B
0
118
Member Avatar for the_mia_team

Write a Python program that creates a dictionary of son-father pairs-you can make the pairs with fictional names for fun. Your program should populate this dictionary with the son-father pairs you made up. Your program should present the user a menu with two options. The following is an example: Father …

Member Avatar for snippsat
0
259
Member Avatar for Ronnicus

test = 4 #start of def def change(): test = 5 #end change() print test Why doesn't it print 5? Can anyone explain this to me? Btw, test = 5 is indented, the forum won't let me indent for some reason

Member Avatar for bumsfeld
0
84
Member Avatar for meisterluv

Hi everyone I was wondering if I could get some help on environment variables. I am executing a cgi file from a C file with execv(). The cgi is able to generate the html template correctly. However I am unable to grab the "REQUEST_METHOD" since it always returns NULL. Can …

0
57
Member Avatar for ragavh

i need to create a program that translates an english phrase to a spanish phrase. i have a text file with english words and their spanish meaning. i am unsure how to start this as i am quite new to phyton. ignore the grammar, i want to translate the phrase …

Member Avatar for jcao219
0
167
Member Avatar for yesha27

here I have code in python and now I want to transfer it in Java. import logging import urllib import re from waveapi import events from waveapi import model from waveapi import robot from waveapi import document from django.utils import simplejson from google.appengine.api import urlfetch def OnDocChanged(properties, context): #Get Contents …

Member Avatar for jcao219
0
183
Member Avatar for froggy1

I would like to find and replace a string in a file. I know how to do this, but I can only do it for all instances. Is there a way to do it for just the first instance of the string in the file? import fileinput for line in …

Member Avatar for froggy1
0
148
Member Avatar for fur8ar

[code] Traceback (most recent call last): File "C:/Python31/sample.py", line 10, in <module> calendar.prcal(year) AttributeError: 'module' object has no attribute 'prcal' [/code] Hello, I just started learning Python with this fantastic site. Unfortunatly I get this when i try to execute the following code [code] import calendar print( "Show a given …

Member Avatar for fur8ar
0
100
Member Avatar for andy_long

hello, I have faced a problem that is almost as same as the problem below: ((((If I try to define a timer in an ogl.BitmapShape, like this: class T6963_device (ogl.BitmapShape): def __init__(self): ogl.BitmapShapeinit__ (self) self.t1 = wx.Timer (self) I get this error Traceback (most recent call last): File "D:\data_to_test\smtest2.py", line …

Member Avatar for ihatehippies
0
181
Member Avatar for G_S

Hi everybody, I'm trying to install python 3 from source in my new Mandriva 2010. I have read a lot of posts in this website, but none of the instructions has worked for me. The code compiles and all, but it doesn't install tkinter. I know that tcl/tk are installed …

Member Avatar for G_S
0
236
Member Avatar for Escom

Hello, i would like to make program in python which reads the lines from an input file, which looks like this: Bob 10 20 30 John 15 15 Kate 20 and the program sums the numbers for each person and writes into an output file which should look like this: …

Member Avatar for dilbert_here00
0
169
Member Avatar for Krstevski

Hello friends, I have created simple rss reader class, but the class contains many loops and didn't work correctly and if anyone wants to help me with code, example, tutorial etc... I would be very grateful. The code of the class you can see on the following link: [url]http://pastebin.com/F7zQdhAW[/url] Thanks...

0
66
Member Avatar for Robbert

Hi I need some help with sizers. I just can not get my head around it and i cant find much on the net about what i am trying to achieve. I am not even sure if i need a grid sizer or two box sizers. This is what i …

Member Avatar for Robbert
0
86
Member Avatar for JonKho

Dear all, My window layout looks like this.. [img]http://i41.tinypic.com/hu27ax.jpg[/img] First, the dialog box that consists of listbox would appear to ask for user input. After the user input has been given, It will display in the next windows.. I have been trying to intergate the two coding together. However I …

Member Avatar for JonKho
0
221
Member Avatar for shusshoku

I'm using python for a project and was curious if anyone knew whether it was possible to open up jpg files in a GraphWin window. Also, the image software I'm using with it is PIL, if that helps.

Member Avatar for bumsfeld
0
72
Member Avatar for pubudugokarella

I'm new to here.so i posted it on the code thread pls go through it and help me [url]http://www.daniweb.com/code/snippet271890.html[/url]

0
79
Member Avatar for bumsfeld

[code]#Blast workbench using biopython from Bio.Blast import NCBIWWW ##result_handle = NCBIWWW.qblast("blastn", "nr", "8332116") fasta_string = "AATTCAGTGGCAAAAAAAAAACTCAAATTTTAGGGAAGGCCCTAATATTATCAAATAATTAGAGGGGGGG" result_handle = NCBIWWW.qblast("blastn", "nt", fasta_string) save_file = open("my_blast.xml", "w") save_file.write(result_handle.read()) save_file.close() result_handle.close() result_handle = open("my_blast.xml") from Bio.Blast import NCBIXML for record in NCBIXML.parse(open("my_blast.xml")) : #We want to ignore any queries with no search results: …

0
323
Member Avatar for ultimatebuster

Is python web programming anything like php? Is there simple examples like submitting a form to perform a calculator functions etc?

Member Avatar for snippsat
0
115
Member Avatar for pyprog

I want to remove all the 1's from the sublists so l becomes [[2], [2], [2]] but have trouble keeping track of indices. Can someone help out? [CODE]l = [[1, 2, 1],[1, 1, 2],[2, 1, 1]] i = 0 for element in l: while i < len(element): if element[i] == …

Member Avatar for vegaseat
0
139
Member Avatar for Axel_Carvalho

Hello. I need some help. I have a function [icode]my_function(a, b, c, d)[/icode] which takes string parameters and output them in different combinations. It works well in IDLE, but I would like to output the result into a file. Such code [code=python]file = open("out_file.txt", 'w') file.write(my_function(a, b, c, d)) [/code] …

Member Avatar for Axel_Carvalho
0
129
Member Avatar for pubudugokarella

I'm a bio informatics student who is leaning programming.With the help of this site and other blogs I made this one so far.I need to create a interface which give a text box to enter sequence and a start button and a window that display results.I went through Wx tutorials …

-3
34
Member Avatar for jozz3

Just a quick one- I'm writing code that asks the user for a filename and checks that it exists. If it does it has to print the file's contents, if not print a message. [CODE]import os fileName = raw_input("Enter the name of the file: ") if os.path.exists(fileName) == True: fileName.read() …

Member Avatar for Gribouillis
0
138
Member Avatar for dunwitch

I'm trying to get a SQLite3 DB to populate a wx.ListCrtl. I can get it to print to stdout/stderr without any problem. I just can't seem to figure out how to display the data in the DataWindow/DataList? I'm still learning programing/python so any advice would be appreciated. After two days …

Member Avatar for Stefano Mtangoo
0
822
Member Avatar for soUPERMan

I have this code: [CODE]class Member: def __init__(self, name, typeOM, fee, yearJoin): self.name = name self.typeOM = typeOM self.fee = float(fee) self.yearJoin = yearJoin # Reader Methods def getName(self): return self.name def getTypeOM(self): return self.typeOM def getFee(self): return self.fee def getYearJoin(self): return self.yearJoin def getMemberTypeString(self): if self.typeOM == 'P' or …

Member Avatar for soUPERMan
0
113
Member Avatar for kingmu

Hi, I have serial data that can come in at irregular intervals from a hand held barcode scanner. The scanner continuously looks for a barcode (no button or trigger is ever pressed) and when the scanner captures a valid barcode it sends the code to the PC over serial. What …

Member Avatar for kingmu
0
715
Member Avatar for toll_booth

I'm trying to code the game of Minesweeper. I haven't put in graphics just yet, only text labels on the buttons. Here is my create_widgets method: [code] def create_widgets(self): #Create the grid. self.square = [] self.isAMine = [] for i in range(self.y): row = [] mineRow = [] for j …

Member Avatar for toll_booth
0
171
Member Avatar for dilbert_here00

Hi all, I am trying to open an excel file which is in the same folder as my python script. The script is able to open the file first time, & after that it just throws the following exception: pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft Office Excel', u"'test .xls' could …

0
72
Member Avatar for chazut

Hello all and thanks in advance for any help you can provide. I'm new to programming in Python and am looking to put todays date parameter passed into a URL string...how would I go about accomplishing this. This is some code I've sort of been messing around with: [start code] …

Member Avatar for chazut
0
6K
Member Avatar for ultimatebuster

[CODE] def dotask(): print "Task done..." def returnvalue(): return "Awesome" cmd = raw_input("Your command: ") eval(cmd + "()") [/CODE] I know that you can't use eval to assign a value to a variable. but is it the best way to have user input be performing a function? For example: I …

Member Avatar for Gribouillis
0
78
Member Avatar for varuab

Greetings, I just want to know how to split a string using values of dictionary: dic = {'': '000', ' ': '011', 'e': '1111', 'g': '10', 'h': '010', 'o': '00', 'p': '1101', 's': '1110', 'r': '1100'} word = '1000011100001110001101010111111001110000' for items in dic.values(): [INDENT]word.split(items)[/INDENT] .... and when i do this …

Member Avatar for woooee
0
153

The End.