15,175 Topics
| |
I found this question on the internet, > Create a text file with name filename and about size bytes. The file should contain > an incrementing number on each line starting with 0. (ie) 0, 1, 2, 3, .... as many are required to make the file size > just … | |
So I have been working on a directory and have not really been able to get it off the ground. As a matter of fact none at all. import H:\Python Helpful Programs\DivisibleBy.py (also: everything is in the same folder) I have also tried just DivisibleBy.py and some others. The error … | |
return the first count multiples of number in desc order in a list. e.g call with input (3,2) returns [6,3] call with input(5,3) returns [15,10, 5] plz help me with this how can i do it using map()?? | |
In this line -> `tcpSerSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)` what is the first 'socket' after the '=' sign, is that refering to a socket class making tcpSerSock an object or just to a module called socket? After reading the documentation I see that socket.accept returns a connection and an address pair, … | |
I wrote a code which fills numbers into the file and when the file exceeds the size given, it stops adding data. But whenever i run the code there is an indefinite run in the data and the size of file just goes off the chart! Please help!! def create_file_numbers(filename, … | |
I'm using python3 on Windows, got a problem with ZEO , when i start a ZEO server (python runzeo.py -a localhost:9000 -f database.fs) on server appears : ------ 2014-01-15T16:24:17 INFO ZEO.runzeo (4080) opening storage '1' using FileStorage ------ 2014-01-15T16:24:18 WARNING ZODB.FileStorage Ignoring index for C:\Documents and Settings\calarasanu\Desktop\Licenta\DBase\Test\zeo\database.fs ------ 2014-01-15T16:24:18 INFO … | |
I have a generator function, i've filled in the function if there are no more_seqs. But I feel trouble if there are more sequences. I need to generate 1 tuple at a time. if the function call is generate_zip(range(5),range(3),range(4),range(5)) then the tuple generated should be (0,0,0,0) (1,1,1,1) n so on … | |
I have a list say word = ["engine","ant","aeiou"] I need to sort the list according to the number of vowels in the list elements. And this sort must change the input as well. I tried writing the code, by using zip() and a few ops i'm getting the required answer … | |
class Point: def __main__(self, x=0, y=0): self.x = x self.y = y def distance_from origin(self): return ((x ** 2) + (y ** 2)) ** 0.5 def distance_between_points(a, b): return distance_from_origin(a) - distance_from_origin(b) I get a global variable error when I try to run the function at the bottom. | |
from random import randint from tkinter import * import time screen = Tk() widthOfScreen = screen.winfo_screenwidth() #Get the width of the screen heightOfScreen = screen.winfo_screenheight() #Get the height of the screen screen.geometry("%dx%d+0+0" % (widthOfScreen, heightOfScreen)) def spammer(): count = 0 for count in range(0,1000): Button(screen, text = count, font = … | |
Dear friends, I need help understanding my error with urllib. I wrote the following code to check the availability of updates for a software I wrote try: datasource = urllib.urlopen("URL to FILE.txt") while 1: line = datasource.readline() if line == "": break if (line.find("<") > -1) : LastVersion="Error" else: LastVersion=line … | |
I have a path I trying to hook up to marathon (an automation testing tool) to locate a folder on an SVN but I keep getting a name error here is the module code def LookUpPathPrefix(pathToFind): from marathon.playback import * inFile = open("paths.txt", "r") mountPointName = "start" while (mountPointName): mountPointName … | |
Hello everyone! I got this question in a book.. I thought of doing it using map() or using loops return the first count multiples of number in desc order in a list. e.g call with input (3,2) returns [6,3] call with input(5,3) returns [15,10, 5] but the hint along with … | |
in web2py table when i m renaming field causes data to be lost and then i m not able to recover data for that table is their any solution that my data should be recover after field change in database | |
Hi, I'm newbie in Python Programming. I created the below code. I want to optimize it, but dont know where to start. I am sure, I can do the same with less lines of code. Please advise on best practices and ways on how to optimize it. import math def … | |
Hi, I am wondering if there is any easy way to up the frame rate of a pygame program. For example locking the frame rate? I don't know. Thanks in advance! 26BM | |
Hi, the following is the code for my a2 computing project. Essentially what I have tried to do is set up two basic structures of GUIS and then inherit them into other classes so I can add components to the basic structure. However, when I create a MainMenu object, only … | |
Hi, I built a Polygon() class that originally only was initialized with veriticies: Polygon(verts=(1,2,3,4) But as the code evolved, I added a few @classmethods to construct the Polygon from other inputs. For example: Polygon.from_center(center=(1,2), length=5) Now my problem is that I'm trying to find the canonical way to choose which … | |
Assume that there are n tyres that could be used by car, tricycle and bicycle. Write a program to accept n tyres and generate all the combinations (i.e. the number) of car(s), tricycle(s) and bicycle(s) that could exhaust the n tyres. Ensure that all the objects have fair share where … | |
In the following program how does the line `r.size = 150, 100` actually set the values using this line -> `size = property(getSize, setSize)`? property has two arguments, getSize & setSize, it seems to me that would only allow it so get one value and set one value. #!/usr/bin/python3 class … | |
I know python is an interpreted language but is there a way to compile your code? What if you write a program in python 3 and the user has python 2.x, or worse yet, doesn't have python at all. How can you create an executable via compiling or any other … | |
Hi i was wondering if anyone could help me, im wanting to when you click in a certain area it changes the background image thanks import Tkinter as tk from Tkinter import* import urllib import base64 def click(event): if event.x > 100 and event.x < 430: if event.y > 100 … | |
I'm trying to write a recursive functionthat receives a parameter n and returns the multiple of 5. Example: if we have 5 as the argument, the print out will be : 5 10 15 20 25 My code: def MultiplyRecursive(r): if r == 1: return 5 else: return MultiplyRecursive(r-1) + … | |
class MemberCounter: members = 0 def init(self): MemberCounter.members += 1 # m1 = MemberCounter() # m1.init() # MemberCounter.members -> 1 # m2 = MemberCounter() # m2.init() # MemberCounter.members -> 2 # m1.members -> 2 #m2.members -> 2 # m1.members = 'Two' # m1.members -> 'Two' # m2.members -> 2 In … | |
#Name: Calum Macleod #Date : November 6, 2012 #Purpose: A Python program with a loop that lets the user enter a series of whole numbers. #The user should enter the number -99 to signal the end of series. #After all the numbers have been entered, #the program should display the … | |
I need to read excel files and compare them and produce new outcomes using Python. i have realized that by suing the following codes I can read an excel file: import xlrd wb = xlrd.open_workbook('values.xls') wb.sheet_names() But i keep getting error of: [COLOR="Red"]Traceback (most recent call last): File "C:/Python26/Atest/filename.py", line … | |
I'm writing a script that downloads files for web design, and this line produces Traceback (most recent call last): File "bootlace.py", line 60, in <module> download(data['jquery'], 'Downloading jquery. (File size %s)', 'js/') File "bootlace.py", line 11, in download file_size = int(meta.getheaders("Content-Length")[0]) IndexError: list index out of range That line is … | |
I'm learning django and for the latest version of the tutorial i'm using, you must have python 3 installed. Despite the fact I have python 3 installed, python 2.7.6 is being loaded. My path originally had no reference to python, so I added it. C:\Ruby200-x64\bin;C:\Users\Freddy\AppData\Roaming\npm;C:\python33\python.exe However, python 2.7.6 is still … | |
| Can the sibprocess.call('') function be used to execute .mp3 files, it doesn't work for me. Which function is used to run any video or audio file from within Python? |
so i "finished" my irc bot in python. by finished i mean it only connects to irc.quakenet.org #cplusplus (you can see it if you connect. its called DTSCode-Bot). however, the point of my class isnt just to create a bot. i also want to create a client. so i cant … |
The End.