15,175 Topics
| |
Hi all, I was just wondering if anybody could point me in the right direction regarding a program that need to be able to track the cursor and draw it's path on the screen. I was thinking about Tkinter, but is there another option? | |
Hi. I am a python newbie seeking some help in working with a file containing rows and columns. I have a file, that ideally contains an equal number of rows and columns. The first row is a tab separated header row and the first column is a label row. The … | |
I made a little python code that makes a ball bounce around the screen. Every time you left click it makes another ball. when you right click it clears the screen but you can't spawn more balls afterward... any help (python, tkinter) [CODE]from Tkinter import * import time import base_translate … | |
Hi, It is my code: [CODE]mylist = [['fiss','giss'], ['e','h'], ['d','u'], ['c','t'], ['b','o'], ['a','z']] for alist in mylist: g = ' '.join(alist) print g f = open("write.txt", "w") f.write(g) f.close()[/CODE] How will I write all the words in the txt file. it is only writing the last line of the file. … | |
hi, is there a way to convert from string to long? for eg: i want to concatenate all the arrays into data and make it same type (long) as data1. [CODE] a='0x' array0 = '00000018000004000000000000000000' array1 = '00000000000000000000000000000000' array2 = 'fe000000000000000000000000000000' array3 = '00000000000000000000000000ffffff' data = a+array0+array1+array2+array3 print data print … | |
hi, i have a script that converts hex to bin and bin to hex back. however, when converting back to hex the leading 0s are truncated. how to maintain the leading 0s? i'm using Python 2.5 and Win XP. tq [CODE] import binascii import string def byte_to_binary(n): return ''.join(str((n & … | |
hey all, i'm trying to get all content of a webpage using python and trying to put them all into a file. Here is my code: [CODE]import urllib data = urllib.urlopen('http://www.site.net/index.html').read() #print data //if i ignore the rest part of this code the code is just working awesome...its printing the … | |
Apache is running in UNIX box, and we have configured folder path in config file and we are accessing python code from that folder. In the python code, we have two methods new_page() and access_form_elements(), new_page() -- print new HTML page with two form elements and method=POST and action=same .py … | |
Hi all. I am new as can be to programming. I always heard a good way to learn to write was to find a project that I am interested in and start from there. So my ideal goal is to write a script that cleans up my downloads folder, ie … | |
I am trying to replace a fixed field name in an XML file with data. I know that I could do it the proper way using XML tools, but, this is a standard templae file that only needs one item replaced. It seems simpler to just hack a replacment. [CODE] … | |
I have two lists which contain titles and links to interesting pages (trying to write a scraper). Where I'm falling down is on the actual printing. [CODE]for i in var1: print i for a in var2: print a[/CODE] Prints all of list 1 and then all of list 2. If … | |
hi all....... I m running a program in windows like this import os os.system('snmpwalk -v2c -c ar441c 192.168.1.10 .1.3.6.1.4.1.18489.1.2.1.1') when i run this i m getting error like [B]SNMPWALK IS NOT RECOGNISED AS A INTERNAL AND EXTERNAL COMMAND,OPERABLE PROGRAM OR BATCH FILE[/B] so anyone can plz help me........ thanks in … | |
I have code the goes to a page and downloads information on its update. Every once in a while it errors out with [code] url2z = url2z.read() File "/usr/lib/python3.1/http/client.py", line 502, in read s = self._safe_read(self.length) File "/usr/lib/python3.1/http/client.py", line 594, in _safe_read raise IncompleteRead(b''.join(s), amt) http.client.IncompleteRead: IncompleteRead(15928 bytes read, 37182 … | |
Hi everyone! New here and to Python. I'm having trouble with my break statement executing and cannot figure out why. I'm learning to write to files and want the loop to break if the user hits enter. It's not working for some reason. I've even tried to get fancy (in … | |
I have to make generetor and ouput must be all combinations.And they are written to .txt file and then user input search from that file. Anyone can help me to wrote that program? | |
Hey, does anyone think they could explain how this code works? [CODE]def hanoi(n, a='A', b='B', c='C'): """ move n discs from a to c using b as middle """ if n == 0: return hanoi(n-1, a, c, b) print a, '->', c hanoi(n-1, b, a, c) hanoi(3) [/CODE] | |
Hello. First of all I am a newcomer to programming languages world and of course very new to Python. In my job, we are using Linux systems. Time to time I need to check some command and script outputs on the terminal. So, I wanted to code a small application … | |
Hi, I get the log messages 'twice' on the console and only once in the log file. Can any one tell me the reason for this duplication on console? here is how I have set the logger: [ICODE]import logging #--set up logging to file logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', datefmt='%Y-%m-%d … | |
I'm trying to put together a code that will basically take a user input string and reprint every 3rd character. i.e. if a user inputs "Superman" it should be reprinted like "S e a" I'm sure this is Uber-simple to you but I'm just starting out, whether it is efficient … | |
I am a beingger for using Python,now I am doing a palindrome program,but I have tried many time it still doenst work, can anyone help me to fix it??Thanks a lot!!!!! Here is the code: [CODE] s=input("Enter alphabetic characters: ") def palindrome(s): index=0 c=True while index<len(s): if s[index]==s[-1-index]: index +=1 … | |
I have a listbox and what I basically want to achieve is as I click a value within the listbox I want the value clicked to be passed to a function. I could easily do this using a button and listbox.GetValue() but I believe the quality of my finished code … | |
Just trying to change the formatting of various bits of my print code. Is there a simple way to do it? | |
So yeah, i figured out how to write program that will print digits in reverse(with small help of the internet, put i get it). Anyway i want to write program that will print digits in their regular order. [CODE]def num_digits(n): count=0 while count <= abs(n): count = count + 1 … | |
Hello daniweb community, i'm new to all this and i'm pretty happy that found this. Anyway i'm having sevral issues. Frist one is: my Python GUI (IDLE) won't open program. [CODE]def num(n): count=0 while count <= abs(n): count = count + 1 n= abs(n)/10 print count num(-23) [/CODE] This code … | |
Hi. I write really terrible python, sort of like using crayons in art class. I have a couple questions. First is: where is the best forum for python newbies to learn how to write better code (standards) and optimize code (faster)? I just joined this forum, so it may not … | |
I am trying to make a basic gui in tkinter for one of my python scripts. I have gotten it to work but I need a way for the user to break the main loop of the script by clicking a button. The loop is a for loop looping through … | |
Help with passing the arguments. This program is supposed to ask for how many numbers do you want. I would stick with ten. Then how many numbers in a randrange (upper limit) Please choose 100 After a list is generated it is supposed to sort the numbers and look for … | |
I want to represent money which is usually to 2DP and I add up items using float values but whenever I have a value that is similar to the one used it only converts it to a string to 1DP. This seems like its going to be annoying to work … | |
im currently studying having a python program supply data to a website. to do this, i am working with a simple example. as a disclaimer to you guys: im quite new with webservers and websites so please bear with me. 1. the python program simply generates a random number continuously … |
The End.