15,175 Topics
| |
Hello, I'm currently working on a school project in which i can not get my head around into figuring out how to make a loop until the user has input an interger this is what i have so far : width = "hi" length = "hello" while width != int … | |
import os import web ### Url mappings urls = [ '/', 'index', '/.*','notfound' ] for root, dirs, files in os.walk("C:/Users/James/Desktop/server"): for f in files: u = os.path.join(root,f) u=u.strip("/").strip("\\") ident=u.lstrip("C:/Users/James/Desktop/server").replace("/","slash").replace("\\","SLASH").replace(".","DOT") globals()[ident] = open(u,mode='rb').read() exec(""" class %(classname)s: def GET(self): global %(data)s return %(data)s """%{"classname":ident+"server","data":ident}, globals(), globals()) #create a class as if were … | |
I have two threads, and, I want one thread to run for 10 seconds, and then have this thread stop, whilst another thread executes and then the first thread starts up again; this process is repeated. So e.g. from threading import Thread import sys import time class Worker(Thread): Listened = … | |
hi friends, To use the built-in web server to improve the infrastructure of the project that I do have some questions, but would like to get suggestions on these issues. 1 I want to accept and process thousands of instant connection 2 I want to do this with a simple … | |
I need some urgent help in the Python programming project. In this project I am implementing the file system which provides the capability to store and retrieve data on the virtual drive. The virtual drive is represented by an ordinary file on the computer. This will create the file on … | |
| I am using Debian Linux and Python 2.7 with PIL. I want to capture an image from a webcam and store it in a file. What are the ways in which this can be done? Also,I want to covert the captured image for modification using Scipy. What is the procedure.for … |
What i'm trying to do is writing Program that print the number of newlines,words and characters in counted file by python I'm lost and i do not how should i do it? that what i got so far infilename = input("Enter the name of the file:") infile = open ( … | |
shutil.copyfile which has a default buffer size of 16384 bytes , as u kno copying wil take more time.. Below is the code that increases the buffer size as 10 MB.. u can copy files that are in Gbs.. import os import shutil def copyFile(src, dst, buffer_size=10485760, perserveFileDate=True): # Check … | |
import sys from PyQt4 import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self, items=None): super(Example, self).__init__() self.items = items or {'India':['New Delhi', 'Bangalore']} self.initUI() def initUI(self): self.combo = QtGui.QComboBox(self) self.cbBox = QtGui.QComboBox(self) self.combo.addItems(self.items.keys()) self.cbBox.addItems(self.items[str(self.combo.currentText())]) self.combo.move(50, 50) self.cbBox.move(50,80) self.combo.currentIndexChanged.connect(self.onActivated) self.setGeometry(300, 300, 300, 200) self.setWindowTitle('Learning by practice') self.show() def onActivated(self): self.cbBox.clear() self.cbBox.addItems(self.items[str(self.combo.currentText())]) def main(): … | |
def main(): print('Welcome to the Fast Freight Shipping Company Calculator for Shipping Charges') print() #constants for the shipping prices weight_one <= 2 weight_two > 2 weight_three > 6 weight_four > 10 weight_one_rate = 1.10 weight_two_rate = 2.20 weight_three_rate = 3.70 weight_four_rate = 3.80 #get the weight of the package using … | |
I am not sure how to do this, please let me know your suggestions. I want to have my python program be able to read the site I visit with a browser (firefox) separately. An example of useage would be this: In the browser log into my account (credit card, … | |
@Gribouillis and other gurus in the house, i just did this code but seem i ssem to be having difficulties in modifying it to work the way i want it.Its a bit lenghty, pls pardon me because am still a beginner in python.This program prints out where a particular property … | |
I am writing a code of the consumer producer problem in python , so far I am almost ready but my code still not running.. Would you help me in any way to finish it, I am new in python and am not sure what I do wrong, any help … | |
Hey guys, I'm new to this website as well as Python and well, programming in general. Anyway, I would like some feedback on this program I wrote, its purpose is to take a credit card number, which the user inputs and determine whether it is a valid or invalid credit … | |
Task A Download the files bank.txt and assignment2.py. The file bank.txt is the input file for the program. It consists of a number of lines of text, each with five fields. These fields are: • The customer’s first name • The customer’s last name • The customer’s account number • … | |
i am a beginner in python and still got a whole lot to learn.i have this exercise that seem too difficult to crack. check it out and see if you can help. here is a simple data set1=["01","34","29","16"] set2=["45","88","19","17"] set3=["56","21","57","20"] set4=["29","42","89","08"] set5=["19","45","56","20"] set6=["85","56","33","78"] using the data above, write this program … | |
i am using cherrypy and i want the list itemes in new line like a=['abc','def','ghi'] abc def ghi in browser | |
I'm experiencing a few issues trying to install rpy2-2.3.7 under Cygwin64 on Windows7 using R 3.0.1 and python 2.7 $ python setup.py install finds R version to be 3.0.1 at the beginning of the install, but on line 158 it bombs out for failing to discover the R version. I … | |
A GPA, or Grade point Average, is calculated by summing the grade points earned in a student’s courses and then dividing by the total units. The grade points for an individual course are calculated by multiplying the units for that course by the appropriate factor depending upon the grade received: … | |
This program uses Python module re for splitting a text file into words and removing some common punctuation marks. The word:frequency dictionary is then formed using try/except. In honor of 4th of July the text analyzed is National Anthem of USA (found via Google). | |
I'm making a class dataset. In it, I'm trying to set the minimum max and the mean. In my given test, I am asking the user to input as many grades as they would like so what I did, for example in minimum is this.. class Dataset(object): def __init__(self, grade): … | |
Hello, I'm still very new to python, and I'm tyring to figure out how I would parse data from an input file. Here is what the input file would look like. B 128.9 hello 2918.1 hi 2938.2 world H 12.2 India 218.6 Lost 29.9 Place C 28.3 Watch 28.4 Found … | |
Just a little fun with Python's named tuple, behaves like a class but is much leaner. | |
Applying the famous Gauss algorithm to determine the date of Easter for a given year. | |
Tadaa! This is my first attempt at writing in Python, trying to solve a good question posed [here](http://www.daniweb.com/software-development/python/threads/32007/projects-for-the-beginner/17#post2016892) #----------------------------------------------------------------------------------------------- # # Python 2.7 # # Calculating area and radius of polygons with known number of sides and the length of this side # Adapted formulas used from this site: http://www.mathwords.com/a/area_regular_polygon.htm … | |
I am trying to do some web scraping on [this](http://www.ncbi.nlm.nih.gov/pmc/pmctopmid/) site. So far I have tried the following but the output it gives me is the source code of the site which is different than I expect. I am trying to follow [this](http://nsaunders.wordpress.com/2013/09/17/web-scraping-using-mechanize-pmid-to-pmcidnihmsid/#more-3520) link which has done webscraping in ruby. … | |
Here is a plan for a (relatively) random numeric dictionary I've put together. I'm hoping that people can help me refine the plan so that I can start incremental coding: #! usr/bin/env python # creates a random dictionary from random import randint # user inputs maximum length of dictionary # … | |
write a program that gets a score from a player and rates it based on the following given a score 0-999,the program should display message 'nothing to brag about' 1000-9999 display message 'good score' if score is over 9999 the program should display the message 'very impressive' if score is … | |
I'm learning to use the pyqt libraries and this code won't work (no output): #!/usr/bin/env python2 # -*- coding: utf-8 -*- from pomocni import Ui_MainWindow from PyQt4.QtGui import QMainWindow, QApplication from PyQt4 import QtCore import sys class MainWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.ui = Ui_MainWindow() self.ui.setupUi(self) def start(): window = MainWindow() … | |
Just looking for some pointers on how I could improve the code. This is my first game ever and python is my first language so it's bit messy but I'll be happy to explain stuff if needed. Hope you guys can help me out. Here it is: **objects.py** try: import … |
The End.