15,190 Topics
![]() | |
People who know me know that Python has always been one of my favorite languages. And over the years, I've been pleased with the array of development tools that have been created for it, including the different IDEs. I also do a lot of work in .NET, primarily with C#. … | |
I just love generators in Python. One of the cool things I found out from [this](http://nedbatchelder.com/text/iter.html) site was that one could send in a value when calling on an active generator. To do so one uses the send() method and a yield like so: "x = yield". The send with … | |
I want to automate an application developed in java and swing controls using python. I tried pywinauto but it is not able to detect java objects. I tried using QTP but my applications dynamic java windows dosen't hava parent window so not able to use it . Any suggestion of … | |
Hello my friends. Look at this please: >>> from bs4 import BeautifulSoup >>> import urllib2 >>> url = urllib2.urlopen('https://duckduckgo.com/?q=3D&t=canonical&ia=meanings') >>> soup = BeautifulSoup(url) >>> links = soup('a') >>> print links [<a class="header__logo-wrap" href="/?t=canonical" tabindex="-1"><span class="header__logo">DuckDuckGo</span></a>, <a class="search__dropdown" href="javascript:;" id="search_dropdown" tabindex="4"></a>, <a href="https://duckduckgo.com/html/?q=3D">here</a>] >>> I used this `https://duckduckgo.com/?q=3D&t=canonical&ia=meanings` as the url, … | |
Hello! How can ask my scipt to print **every word** in a url page that starts with the letter "A" in this case? This is my code: from bs4 import BeautifulSoup import urllib2 url = 'http://www.thefamouspeople.com/singers.php' html = urllib2.urlopen(url).read() soup = BeautifulSoup(html) for word in soup.text: if soup.text.startswith('A'): print soup.text … | |
I have written a simple message encoded that encodes messages into words of 4 characters each. It generates a key that will later be used to decode the message. The key is a list of numbers. The numbers are the original whitespace positions before the encoding started. The problem: My … | |
We have had several snippets on the format() function. This one gives a condensed overview of the many options you have. | |
Hello. I am was doing research on cryptography and found a simple algorithm (One time pad algorithm) that interests me. I was able to create a simple version of this that only works with capital letters. The problem however is that the encrypted contents doesn't only contain capital letters. It … | |
Hi guys, I'm stuck on this. I'm trying to draw 2 triangles in Turtle (not what you think). I'm trying to get it to look like this: http://gyazo.com/5abdd3bc05a44945f1a74286e2ad43c6 What I have: http://gyazo.com/65357ea5d43a7dc49e89879a27e980b4 Code: forward(200) left(120) forward(200) left(120) forward(200) right(120) hideturtle() done() Any help is greatly appreciated! | |
I have a layout for an app that has a panel that places 3 static boxes (nodes) per row, and then keeps going until the dictionary of nodes is out. I figured out the flex grid sizer to do so (wrapped by regular boxsizers to add padding above and on … | |
I need to submit a form on which there is a group of inputs(that can be dynamically generated) that needs to be an array of objects(list of dictionaries). I Dynamically generate the following item when a button is clicked on the form: var count = 0 $("#add-order-item").on("click", function(){ count += … | |
A very basic pygame sprite example. Moving a sprite with the arrow keys, could be the start of a great space game. | |
As a result of my research in number theory I find that I often need to break a number down into its numerical parts while stepping through one divisor to another. I call this process "break factoring," as I am just breaking a number down into parts, and not necessarily … | |
Also because of my work in number theory, I often need to have the root floor and root ceing of a number. This is my function for computing those two numbers from a target number. | |
I do a lot of work in number theory, especially with factors. I often need just the two middle factors from a very long factor list/result, so I created a function that takes a factor list and returns just the middle two, or one, factors. Nothing earth shattering, but I … | |
I am trying to make a small dice roll program. By using after(), I would like to make a small "image animation". that displays an other image every ... ms. Unfortunatly sofar only the final image(of the dice roll outcome) is shown and not the visual animation. Does any one … | |
import tkinter from tkinter import ttk top=tkinter.Tk() top.title("Scoreboard") top.configure(background="black") w=ttk.Scrollbar(top,orient='vertical') l1=tkinter.Label(top,height=2,width=67,bd=4,text="Welcome To Cricket World Cup 2015",font=("Purisa",15),fg="white",bg="red",relief="ridge") l1.grid(row=0,column=0,columnspan=67) l2=tkinter.Label(top,height=2,width=25,font=("Purisa",15),text="India",fg="white",bg="red",relief="ridge") l2.grid(row=1,column=0) l3=tkinter.Label(top,height=2,width=15,font=("Purisa",12),text="VS",fg="white",bg="black") l3.grid(row=1,column=1) l4=tkinter.Label(top,height=2,width=25,font=("Purisa",15),text="Australia",fg="white",bg="red",relief="ridge") l4.grid(row=1,column=2) l5=tkinter.Label(top,height=9,width=67,bd=4,font=("Purisa",15),bg="red",relief="ridge") l5.grid(row=3,column=0,columnspan=67) l6=tkinter.Label(top,height=2,width=15,font=("Purisa",12),text="India",fg="white",bg="Black",relief="ridge") l6.grid(row=3,column=0,rowspan=1,sticky="NW") l7=tkinter.Label(top,height=3,width=14,font=("Purisa",20),text="183/2",fg="white",bg="Black",relief="ridge") l7.grid(row=3,column=0) l8=tkinter.Label(top,height=3,width=14,font=("Purisa",20),text="45.1",fg="white",bg="Black",relief="ridge") l8.grid(row=3,column=2) l9=tkinter.Label(top,height=3,width=20,font=("Purisa",12),text="RR = 4.057 ",fg="white",bg="Black",relief="ridge") l9.grid(row=3,column=1,rowspan=1) l10=tkinter.Label(top,height=2,width=15,font=("Purisa",12),text="Toss = Australia",fg="white",bg="Black",relief="ridge") l10.grid(row=3,column=2,rowspan=1,sticky="NE") l11=tkinter.Label(top,height=7,width=67,bd=4,font=("Purisa",15),bg="red",relief="ridge") l11.grid(row=6,column=0,columnspan=67) l12=tkinter.Label(top,height=2,width=13,font=("Purisa",20),text="Player name",fg="white",bg="Black",relief="ridge") l12.grid(row=6,column=0,sticky="NWE") l13=tkinter.Label(top,height=2,width=12,font=("Purisa",20),text="Balls",fg="white",bg="Black",relief="ridge") l13.grid(row=6,column=2,sticky="NEW") l14=tkinter.Label(top,height=2,width=11,font=("Purisa",20),text="Runs",fg="white",bg="Black",relief="ridge") l14.grid(row=6,column=1,sticky="NWE") l15=tkinter.Label(top,height=1,width=10,font=("Purisa",14),text="44",fg="white",bg="Black",relief="ridge") … | |
#Template for Program 6 #Complete the code in each module as discussed in #the Program 6 Instructions def main(): #initialize variables so incomplete code won't cause errors #can be deleted once code is finished totalRainfall = 0 minRainfall = 0 maxRainfall = 0 #prints the progam title and a blank … | |
#Template for Program 4 #Note: This program does not require the use modules (Ch 3) #Remember to indent code that is within the for loop (4 spaces or 1 tab) #print the progam title and a blank line #get input for number of months and store as integer #for loop … | |
Hello, I have this code which is working import Tkinter as tk from Tkinter import * LARGE_FONT= ("Verdana", 12) class ChangePages(tk.Tk): def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) container = tk.Frame(self) container.pack() container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) self.frames = {} for F in (MainPage, Page01, Page02): frame = F(container, self) self.frames[F] … | |
@Niloofar24 was looking for an Iranian datetime package and last night I found one in the internet so I wrote a simple code which counts the days and hours and seconds to Iranian new year | |
Hi friends! I want to create a countdown program. Here is my code: from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label import datetime class CountdownApp(App): def build(self): delta = datetime.datetime(2015, 3, 21, 2, 15, 11) - datetime.datetime.now() days = delta.days days = str(days) self.label_days = Label(text=days … | |
Hello. I have a homework. I have asked to create a web crawler that be able to enter into a music website and then for the first step, collect the name of singers that their names starts with the letter "A". Now i need a little help for this step. … | |
Dear friends, I have a set of files created at certaing time. I would like to group the result where consecutive time difference is more than 1 minute. For example A 10:01:25 B 10:01:29 C 10:01:52 D 10:01:58 E 10:02:12 F 10:02:22 G 10:11:01 H 10:11:18 I 10:30:00 The above … | |
This is my code: from tkinter import * def ftm(feet): return feet * 0.305 def mtf(meters): return meters / 0.305 def convert(amount, func, result): value = func(float(amount.get())) result.set(round((value), 3)) def choose(): choice = lol.get() if choice == "ft": feet = StringVar() meters = StringVar() rest = Toplevel() f3 = Frame(rest) … | |
Instead of using letters as substitutes for playing card suits, I came up with a way to use unicodes to produce the common suits. The following creates the coded needed, makes the deck, and then prints the deck. The printing was the hard part. Is 2.7, and should be 3.0+ … | |
My code and funcs for printing to columns in 2.7 and 3.0+ using print(). I had to relearn column formatting as I moved to using the print() function, and so the follwing is a result. Inspired and partially copied from discussion on [StackOverflow](https://stackoverflow.com/questions/9989334/create-nice-column-output-in-python) def main(): # Main Code v_Data = … | |
Hi. How i can ask my crawler to print only the text of all <li></li> tags in a url page? I want to save the text of all <li></li> tags in a text file (without` <li></li>` words.) | |
One day I got to wondering if it was possible to get a Python script to modify itself. After a few searches I found [this](http://showmedo.com/videotutorials/video?name=7610000&#) solution that I present here. I did not write this code, but feel that it should be "paid forward" so others know that it is … | |
Hello! I've got a question about implementation of a standart tree model for TreeView. I have a response from database that lools like [ [A, [a,b,c]], [B,[a,b,c]], . . . [N,[a,b,c]] ] And I want to pass it through treemodel to treeview, for in GUI it looks like that: A … |
The End.