15,175 Topics
| |
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 … | |
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 … | |
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 | |
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 … | |
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 … | |
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 … | |
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 … | |
[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 … | |
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 … | |
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 … | |
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: … | |
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... | |
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 … | |
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 … | |
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. | |
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] | |
[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: … | |
Is python web programming anything like php? Is there simple examples like submitting a form to perform a calculator functions etc? | |
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] == … | |
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] … | |
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 … | |
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() … | |
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 … | |
| 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 … |
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 … | |
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 … | |
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 … | |
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] … | |
[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 … | |
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 … |
The End.