15,185 Topics
| |
I have been using Python for a few months in a Windows environment with IDLE. I installed Python on my (new) Macbook and opened the same files, but am now getting strange results. These are scripts that worked fine in Windows: 1. When I use a function to open and … | |
The following code does the same lookups using a list and a dictionary. Lists are sequential in memory, meaning that the program has to get the offset for the beginning of the item it wants to use, go to that offset, compare to what it wants to find, and go … | |
Hello, I'm a newbie to python and I am having a very hard time trying to solve a homework question that I have. Here it is: Given a list of items, write a program that generates a list of lists of the following form: [a,b,c,…,z] → [[z], [y,z], [x,y,z], … … | |
how can i plot the graph for the below code.I am having matplot library.plot graph for time vs v1 and time vs v2 and in Time1.csv file for tS import csv def test1(): inputCSV = open(r'test.csv', 'rb') outputCSV = open(r'test1.csv', 'wb+') appendCSV = open(r'test1.csv', 'ab+') cr = csv.reader(inputCSV, dialect = … | |
Hello, I have added a image file to my code in tkinter but it basically fills my the whole frame so if its possible can you recommend a tutorial that shows or explains how to do this.... unless you can show me on here. I havent added my full code … | |
I want to make a program in which you can edit pictures or similar to paint in windows. Does anyone have any idea how? | |
I have 8 teams who have to play each other in a round-robin format, therefore 7 rounds, but only have 4 fields. How can I write a script to allocate fields to games in a fair manner so that any one team only plays on the same field as few … | |
Dear all , i have an csv file . I wanna copy content particular column and paste in another csv file.where i am trying to calcultion and plot graph assume original csv file contain i.e column 4 contain time(hh.mm.ss) format continue by other columns i wanna copy these data to … | |
pleae help how to start coding to concantenate strings that contains numbers and string | |
Hi, I just started learning python a few days ago...and I'm already stuck on something easy TT.TT I have a Tab-Separated-Values data.tsv file that contains 3 columns (country name, area, and population). here's a snippet of my current tsv file country area population MACAU 28.2 578025 MONACO 2 30510 SINGAPORE … | |
first of all my apoligies if i asked something irrelevant, i am new to programming ad also new in python, my question is: i have to write a simple program in which i have to ask for the number of employee in the company and then i have to create … | |
I'm following a tutorial for making tiled maps in pygame and on the very first piece of code I'm getting an error. (http://qq.readthedocs.org/en/latest/tiles.html) On this line "for tile_x in range(0, image_width/width):" it's raising this error: "'float' object cannot be interpreted as an integer". The image dimensions I'm loading are 96x64. … | |
Hi, there's a list with tuples. lst = [('Meat', 'Milk'), ('Cake - Cookie',), ('Apple', 'Orange')] For each tuple of `len == 1` I want to split it at ` - ` so it results with: lst = [('Meat', 'Milk'), ('Cake', 'Cookie'), ('Apple', 'Orange')] I tried [tuple(x.split(' - ') for x … | |
how should i get going with testing, I have never used unitest before, however I tried nosetest a while back, but i want to get my hand on unitest, can anyone suggest me examples | |
hello, i was only wondering if there were other ways of making a quadratic formula calculator in python. i recently made one my self by making a module i named quadratic which is shown below: def get_coefficients(): a = float(raw_input('a = ')) b = float(raw_input('b = ')) c = float(raw_input('c … | |
def binary_search(data,key): found=False low=0 high=len(data)-1 while(not found and low<=high): guess=(high+low)//2 if (key==data[guess]): found=True else: if (key<data[guess]): high=guess-1 else: low=guess+1 if(not found): guess=-1 return guess def test(): seq = [] for i in range(1,1001): seq.append(i) for j in range(1,100): is_pass = (binary_search(seq,j)==j-1) assert is_pass == True, "fail the test when key … | |
I have this email program but it doestn seem to work, the emaik never arive at the reciever, not even in his spam folder from email.mime.text import MIMEText from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from smtplib import SMTP msg = MIMEMultipart() msg['Subject'] = 'Email From Python jajaja' msg['From'] … | |
I am trying this example from Byte of Python, Chapter 10. I can't seem to get this zip to work. I am not sure if the syntax for windows is written correctly or not. I have tried running from interpreter and as a script and both return Backup FAILED. Anyone … | |
Python for Pentesters! I study computer forensics and IT security in university. I would like to know how to use python for penetration testing. Is there any courses or site to teach you how to create own tools for penetration testing? We study more Perl for IT forensics but I … | |
**Reading two files?** I will be very grateful to get help about this script. Apython script which can be used to have a convenient format to print the bill in a store. Your script is reading two files: The first one is containing a list of lines and each line … | |
'"No, thanks, Mom," I said, "I don't know how long it will take."' | |
i am having problems creating multiple frames and getting them in the right place. i want to put 4 frames on my display so i can have a display like the first attachments but this its not working and the 2 frame is going straight to the middle when i … | |
hi guys im stuck in this question would anyone care to help me(its a csv file)?? How many times does the least common string appear in the field [gemstone]? valid gemstone owing mark channels code No Diamond 26.06 20 218 (KJQ:10E)2 Yes Diamond 15.43 25 36 (DRX:25H)7 No Sapphire 11.44 … | |
hi i wrote a Gui program in python3.2. i want to convert my .py program into a windows executable file(.exe). i googled for it and found py2exe but it only supports 2.7 . is there anyway i can convert my program. | |
There used to be an open source initiative called sla2pdf which used a python script to convert Scribus sla files to pdf. Unfortunately downloading the programs from https://code.google.com/p/sla2pdf/ is no longer possible. Is there anyone who knows where to find the programs and preferably some documentation ? Many thanks, P | |
from __future__ import print_function, division #requested per VPython import time from visual import * #make sure this is asterisk char, copy/paste no go ## constants mzofp = 1e-7 L = 2.5 q = 2*1.6e-19 scalefactor = 7e-9 deltat = 9e-20 #objects & initial conditions particle = sphere(pos=vector(0,0,-4e-10), radius=1e-11, color=color.red) velocity … | |
I've been looking around for an answer to this but have had no luck. I need to take two files and print the top most frequent words they have in common as well as their combined(sum) frequencies. This might be simple but I'm pretty new to programming. Any help? def … | |
class BTNode(object): """A node in a binary tree.""" def __init__(self, item, left=None, right=None): """(BTNode, object, BTNode, BTNode) -> NoneType Initialize this node to store item and have children left and right, as well as depth 0. """ self.item = item self.left = left self.right = right self.depth = 0 # … | |
I have numpy type array, array[x][y], 16bit, little endian. How to save this to a tiff file as an image?. | |
Let's say I have a user input a string. string = input("enter a string") and that string ends up being something like "hello world!" but with a lot more whitespace. string = "hello world!" I want to condense this user's input so that instead of all that whitespace I only … |
The End.