15,190 Topics
![]() | |
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 … | |
Hi, I want to identify the datatypes of the te entire dataframe and group it as String, Number and Date. Required Output: Attributes Datatype A String B Number C String As of now I am using the code: for col_number in range(len(data_frame.columns)): datatype = data_frame[data_frame.columns[col_number]].apply(type).unique()[0] if (datatype is np.str or … | |
I know to access tasklist of our machine can be done through os.popen('tasklist').read(). Is there any way to read the tasklist (taskmanager data) of other systems connected in a network using Python? Just reading them will be fine. Purpose: Main objective of this is to write a script which will … | |
All, I have this very basic script that's producing some odd output. What I need to do is constantly ping a server, and when/if that server stops responding, I want to write the timestamp and " timed out" to a file. We're trying to lock down a time as to … | |
![]() | I have a series of (~950KB) '.txt' output files from a computational chemistry program; Each file will contain the line '****optimisation achieved****' at least once and, depending on the result of the calculation, possibly twice. Does the following code, in which I am trying to find specific lines and print … |
![]() | I have the following directory/file setup (this is simplified): Ce +---top.txt +---X0.0 | | | +---Y0.0 | | | | | +---X0.0Y0.0Z0.0.dat | | +---X0.0Y0.0Z0.05.dat | +---Y0.05 | | | +---X0.0Y0.05Z0.0.dat | +---X0.0Y0.05Z0.05.dat +---X0.05 | +---Y0.0 | | | +---X0.0Y0.0Z0.0.dat | +---X0.0Y0.0Z0.05.dat +---Y0.05 | +---X0.0Y0.05Z0.0.dat +---X0.0Y0.05Z0.05.dat Within each Y directory, … |
0 down vote favorite I am trying to read float numbers from a Binary file using Struct module and then storing them in numpy 3D arrays.When I run it as an independent script, it works fine.But when I call it as a class's function from another script(after import) it gives … | |
I need to retrieve all the filenames ending with .xml extension from all the subdirectories present in a directory and copy those names into a new .xml file. | |
hi guys, I'm new to python and i can't seem to understand this one line of code right here: distance, coordinates = min([(someFunction(state, coordinates), coordinates) for coordinates in coordinatesList]) coordinatesList contains a list of paired coordinates (x,y). someFunction returns an int. My question is why isn't distance and coordinates contain … | |
write a program that stimulates flipping a coin 100 times and then displays the total number of heads and total number of tails achieved | |
Hello, I am working on a Tk program that generates geometric patterns, and I have written into all of my defs that if the variable "outline" is True it will draw a black outline, otherwise it will draw an outline the same as the fill. I tried a function called … | |
I have a database with the following structure: lat lon id 19.7 -95.2 1 19.7 -94.7 1 19.3 -93.9 1 19 -93.5 1 19 -92.8 1 19.2 -92.6 1 19.9 -93 1 20 -92.8 1 23.1 -100.2 2 23.2 -100 2 23.3 -100 2 23.3 -100.2 2 23.4 -99 2 … | |
So! I'm building a GUI for an application I'm currently developing and I'm having a bit of trouble figuring out an issue. I'll try to explain it as best as I can in the code lines. Basically, I built a class to handle the initial window for the program, but … | |
The syntax of the [icode]str.format()[/icode] method described in [url=http://docs.python.org/library/string.html#formatstrings]the python 2.6 documentation[/url] looks both powerful and complex. The idea of this thread is to start a collection of nice formatting examples which will ease the task of mastering this function. Please post useful examples, and document them :) | |
def main(): #this program calculates the total price of a meal after inputting cost of food #tip and sales tax print ('Welcome to the Meal Calculator Program') print() #get the cost of food using the input function food_cost = input ("Please enter the price of your meal: ") food_cost = … | |
Hi, i have this output from a SQL query : new = (('{reason:slash,data:{"SET0":"=SET2"}}',), ('{reason:slash,data:{"""REM_1""": """=0xFF""", """REM_2""": """=0x1""", """SET0:REM_3""": """=SET2:REM_3""", """MREM_4""": """=0xFF"""};{}}',)) I am trying to get it such that i put all these items in a dic in the following manner : {'MREM_4': '=0xFF', 'REM_2': '=0x1', 'REM_1': '=0xFF', 'SET0:REM_3': '=SET2:REM_3'} … |
The End.