15,175 Topics
| |
hello, I think it is just a silly thing but i can't work out why im only getting one number back from this..? def MakeList(n): # Returns a list of n random numbers List = [] for i in range(0, n): List.append(random.randint(0,1000)) return (List) MakeList(10) I get: [546] But if … | |
A short code to show you how you can download and display an image from the internet on Python's Tkinter GUI toolkit. | |
I have two text files containing multiple lines of text, I need to compare both files and write the missing lines in the file two. i will use a while loop for check every 60 seconds, i an idea but just work 1 pass File one: 2012-10-04 01:03:11,50EF87C3.req,192.168.1.1,12312312312,OK -- HUAWEI … | |
I'm wanting to create a while loop that asks the user if he wants to run the program or not... very basic... I know. I was wanting the prompt to ask the user to input "Y" or "y" to have the program run. Like this: programStart = str(input("Please press 'y' … | |
#! /usr/bin/python import numpy as np data = np.loadtxt('path-tracks.csv',dtype=np.str,delimiter=',',skiprows=1) print data [['19.70' '-95.20' '2/5/04 6:45 AM' '1' '-38' 'CCM'] ['19.70' '-94.70' '2/5/04 7:45 AM' '1' '-48' 'CCM'] ['19.30' '-93.90' '2/5/04 8:45 AM' '1' '-60' 'CCM'] ['19.00' '-93.50' '2/5/04 9:45 AM' '1' '-58' 'CCM'] ['19.00' '-92.80' '2/5/04 10:45 AM' '1' '-50' … | |
Hi , I am new to python coding . I have a Strace output file and i need to extract two columns. The sample Strace file i have attached here i would like to extract the "calls" columns and store the count of the calls withrespect to the syscall. I … | |
Hi, I am given this assignment that should be run in Jython. The assignment says that the program consists of a Java application with a canvas and a textarea for turtle code. I need to create a Jython application that takes turtle code from the Java application, parses it with … | |
Just a simple Jython code to test drawing on the canvas. | |
I have a strange problem, I have written a for loop to check a list of words for a match and it is not checking all of the words: I am using two files to check for matched words (Enwords.txt - a list of English words and Encontract.txt - a … | |
I have been playing around a bit and I want to know if you can update a global varaible... rowA = [] def printSeat(): global rowA print "A", rowA = ['*', '*', '*', '*', '*', '*', '*', '*'] print rowA print "B", rowB = ['*', '*', '*', '*', '*', '*', … | |
I want to convert a Pandas DataFrame series to a List. In [63]: bayFails Out[64]: 0 [0, 1, 4, 5, 6, 8, 9, 12, 13, 14] In [63]: type(bayFails) Out[64]: <class 'pandas.core.series.Series'> Can someone show me how to convert bayFails into a list? | |
Hi, I'm new to Python and am having trouble with this. Here's my code: import urllib, urllib2, re import xml.etree.ElementTree as ET from bs4 import BeautifulSoup # The get_zipcode(address) function will be called with an address string with # no zip code, such as 'Lowell Observatory, Flagstaff, AZ', and it … | |
Hi Folks, My partner and I are experienced investment professionals with a background in mathematics. We are picking up Python now and we're gonna take this free online class from UC Berkeley on AI programming. We're looking for a third to join in our study group, contrast approaches, discuss topics, … | |
I am making a basic comand line program that does conversions in python and i want to add more conversions to it without scripting. so you can command the program something like (you command the PC) add new_conversion (The PC ask) name the new_conversion: *here you enter your function name* … | |
So my program is progressing quite nicely, and I'm semi-proud of myself for getting this far (I'm a newbie), but I had 2 questions. One question is that my program recognizes a .CFG extension...but never finds games with any other extension (.smc, .srm). I type it in EXACTLY as it … | |
(Just to preface this, I am a Python noob, so parts may be stupid/less obvious to me) I am trying to compile a Python script to exe, with the following setup.py file: from cx_Freeze import setup, Executable includes = ["re", "PyVMF"] setup( name="Wall Tile Randomizer", version="1.2", description="Wall Tile Randomizer", executables=[Executable("WallRandomizer.py")], … | |
A small test program exploring the PySide/PyQT Label widget. With HTML code you can do some nice formatting of the label's text. | |
Basically, I am trying to extract text between two strings within a loop as one of the two words changes after the information is extracted. so for example, the string is: string = alpha 111 bravo 222 alpha **somethingA** end, 333 bravo **somethingB** end 444 alpha 555 bravo So I … | |
The PySide/PyQT QValidator restricts the type of input a widget like QLineEdit can accept. Here is a simple test. | |
Ok so, question about opening an application from python..is there a command that will force an app to open, while at the same time leaving the tkinter GUI open? The app I am trying to open is Snes9x. import os from tkinter import * try: import Tkinter as tk from … | |
Hello all! Hope to be a very active nad productive member here as I learn. Currently in a python class and have a problem to solve. Not quite sure where my mistake is.... I am to put the inputs in the main function pass to the processing function and call … | |
Another exercise in applied geometry. This time we use the Tkinter GUI canvas and its create_line() function to draw a triangle, or a series of connected triangles to create something that looks like fancy art work. You might be able to impress grandmama with that one! | |
with python interpreter `E:\Dropbox\Research_Study\myprojects\Batch>python Render.py ` Traceback (most recent call last): File "Render.py", line 801, in <module> else: run() File "Render.py", line 789, in run win = Window() File "Render.py", line 66, in __init__ self.createUI() File "Render.py", line 314, in createUI self.sfEdt.setValidator(QtGui.QIntValidator()) TypeError: arguments did not match any overloaded call: … | |
I'm trying to expedite the process of manually opening up an XML file and searching for some info in it. I want to store some of the data, etc. Nothing elaborate. But I'm not clear on some of the file structure. For the seasoned XML data wrangler, can you instantly … | |
Hi, I have python 2.7 & python 3 installed on ubuntu. I just installed pygame and have it working so far in python 3 which is what I want to be doing. However I can only load bmp images in python 3. When I try to load a jpg I … | |
alright so my exact problem is that when I attempt to visit a url stored in a text file I get the error "URLError: <urlopen error no host given>" This is strange because if I type in the urls myself they work fine(opener.open("site.com")) The lines of code causing the error … | |
I have my battleships game working completely accept ships do not generate randomly. I have each point of the ship assigned to certain squares. Example: ship_1_1 = Grid[1][1] ship_1_2 = Grid[1][2] ship_1_3 = Grid[1][3] ship_1_4 = Grid[1][3] Randomly generating ships is harder than I thought. For these reasons: - Ships … | |
A function to take a text and extract the string between two given substrings. Allows you to find the nth occurence. Also safeguards against dead ends. | |
I kind of have an idea what to do, but I can't figure it out. The program needs to be able to get the students name and three test scores, then get the average score (percentage) out of the three scores. After that, you need to convert the score (percentage) … | |
Hi again, I've been looking more at reading serial - this time with a GUI in front. After attempts to get it working I thought it best to try threading to perform the task. What it should do is read the serial port and update a label with the frame … |
The End.