15,194 Topics

Member Avatar for
Member Avatar for joshuawilson11

Hi so in my list i have multiple characters - '32' which i need to replace with a space, would anybody be able to give an example of how to do this? Thanks

Member Avatar for vegaseat
0
140
Member Avatar for fatalaccidents

Hello all, I'm hoping this is related enough to python to merit being posted here. I'm hoping someone will possibly have a better way of doing it altogether. I'm using tetgen to try to create a hollow dome. I was using triangle and then just triangulating a circle and raising …

Member Avatar for fatalaccidents
0
2K
Member Avatar for joshuawilson11

Hi,so I am supposed to encrypt a text file chosen by a user at the moment I have completed most of it (offset factor/shift), I have got each separate character from the text file and put it into a list and converted it into ASCII, I am wondering how you …

Member Avatar for joshuawilson11
0
510
Member Avatar for Kristal_1

Can someone please give me an example code for a tkinker GUI of a reverse polish notation calculator written in python.

0
151
Member Avatar for jeffcogswell

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#. …

Member Avatar for Tcll
3
2K
Member Avatar for BustACode

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 …

0
354
Member Avatar for Ragunath_1

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 …

Member Avatar for vegaseat
0
70
Member Avatar for Niloofar24

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, …

Member Avatar for vegaseat
0
596
Member Avatar for Niloofar24

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 …

Member Avatar for vegaseat
0
491
Member Avatar for CodeWarrior14

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 …

Member Avatar for vegaseat
0
352
Member Avatar for vegaseat

We have had several snippets on the format() function. This one gives a condensed overview of the many options you have.

Member Avatar for BustACode
6
932
Member Avatar for CodeWarrior14

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 …

Member Avatar for vegaseat
0
374
Member Avatar for Mate_1

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!

Member Avatar for vegaseat
0
984
Member Avatar for linus72982

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 …

Member Avatar for vegaseat
0
257
Member Avatar for renierdbruyn

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 += …

Member Avatar for Schol-R-LEA
0
357
Member Avatar for vegaseat

A very basic pygame sprite example. Moving a sprite with the arrow keys, could be the start of a great space game.

0
6K
Member Avatar for BustACode

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 …

Member Avatar for vegaseat
1
336
Member Avatar for BustACode

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.

Member Avatar for vegaseat
0
456
Member Avatar for BustACode

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 …

Member Avatar for vegaseat
0
376
Member Avatar for Igor_1

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 …

Member Avatar for vegaseat
0
1K
Member Avatar for Johnny Blaz

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") …

Member Avatar for vegaseat
0
4K
Member Avatar for Edward_6

#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 …

Member Avatar for vegaseat
0
1K
Member Avatar for Edward_6

#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 …

Member Avatar for Edward_6
0
174
Member Avatar for davidbr

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] …

Member Avatar for davidbr
0
4K
Member Avatar for fonzali

@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

Member Avatar for fonzali
0
531
Member Avatar for Niloofar24

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 …

Member Avatar for ms95
0
3K
Member Avatar for Niloofar24

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. …

Member Avatar for iJunkie22
0
380
Member Avatar for giancan

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 …

Member Avatar for Gribouillis
0
183
Member Avatar for Rekt

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) …

Member Avatar for Rekt
0
3K
Member Avatar for BustACode

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+ …

Member Avatar for fonzali
1
1K
Member Avatar for BustACode

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 = …

Member Avatar for vegaseat
0
395
Member Avatar for Niloofar24

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.)

Member Avatar for Niloofar24
0
3K
Member Avatar for BustACode

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 …

Member Avatar for Gribouillis
0
212
Member Avatar for annndrey

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 …

Member Avatar for vegaseat
0
3K
Member Avatar for Taqwasarwar

Hi everyone, I am a beginner in python, and I would really appreciate if someone could help me with this. Basically I am trying to write a program where I will be importing a file that has a lot of numbers in many lines, there are also some blank spaces. …

Member Avatar for vegaseat
0
311
Member Avatar for Odyssey2001

Hello!!I have a database and I want to display its data into a QTreeView in PyQt.The database's column has file paths.I have a problem in filling this treeview with data because it's a database and I'm not sure if it is like working with txt files and because it is …

Member Avatar for Odyssey2001
0
705
Member Avatar for psvmr

I am trying to sort averages of scores in a class by pupil, from highest to lowest. My data is stored in text files like this: Charlie:0 Seema:2 Amber:4 Paige:5 Amber:8 Keith:1 Charlie:8 Seema:0 Charlie:9 Seema:3 Paige:0 Paige:4 Paige:4 Charlie:1 Keith:5 Keith:3 Here is my code so far: with open("class …

Member Avatar for vegaseat
0
971
Member Avatar for psvmr

I have been trying to create a program which the teacher log in to view the scores of a test of a school class. The scores are stored in a text file like this: Charlotte:7 Charlotte:4 Charlotte:3 Chelsea:2 Chelsea:9 Chelsea:5 Jeff:1 Jeff:10 As you can see there are multiple scores …

Member Avatar for vegaseat
0
676
Member Avatar for Niloofar24

Hi everybody. What is the usage of `urljoin`? An example: >>> from urlparse import urljoin >>> url = urljoin('http://python.org/','about.html') >>> url 'http://python.org/about.html' I think the answer is that when we take a link from here `'http://www.python.org/` for example , it looks like this `<a href="/about/>about</a>`. So if i take the …

Member Avatar for Niloofar24
0
833
Member Avatar for vegaseat

Well I done it! Got bored after the holidays and bought a Raspberry Pi credit card sized computer ($35), the least expensive LED TV and a Logitech wireless Keyboard/Mouse combo. The way I ordered the kit it cost almost twice as much, but it came with a good 2.5A powersupply, …

Member Avatar for vegaseat
0
668
Member Avatar for Niloofar24

Hello. I'm trying to create a web crawler. I've read about web crawler's duty and about how it works and what he does. But just need more information. Could you please tell me what does a web crawler can do? What kind of duty i can define for my web …

Member Avatar for Niloofar24
0
328
Member Avatar for vegaseat

One way to find the shortest distance between a series of surface (x, y) points is to let Python module itertools find the non-repeating combinations of point pairs. Now you can apply the Pythagoras' theorem to find all the distances and the minimum distance.

Member Avatar for gerisam
3
2K
Member Avatar for Niloofar24

Hello, me again :) With this code: >>> from BeautifulSoup import BeautifulSoup >>> import urllib2 >>> url = urllib2.urlopen('http://www.python.org').read() >>> soup = BeautifulSoup(url) >>> links = soup('a') >>> print links A list of links printed into the terminal. I want to send the list into a text file, i tried …

Member Avatar for Niloofar24
0
738
Member Avatar for mcroni

hi, i have created a drug dispensing client to be used by a pharmacy shop as a project. i need to add a function that can tell whether a drug has expired in the database. Csv was used. any idea how i should go about it. Thanks

Member Avatar for Santanu.Das
0
64
Member Avatar for DragonMastur

I am try to make a program that alows the user to input their username and password to recive a set of options. Right now the options are to look at a file or quit. In order to complete it I need to know how to turn of the visability …

Member Avatar for DragonMastur
0
515
Member Avatar for Gribouillis

Given a unicode string or file, what is the best way to find a short unicode string that is **not** a substring of the first one ? I want a working algorithm that avoids transforming the first string into a list of characters. My first idea is to choose a …

Member Avatar for Gribouillis
0
334
Member Avatar for Kai_Chang

Well this is my basic code for my RPG, can I have help improving it? import cmd import json from rpg_data import * class RPG(cmd.Cmd): def do_n(self, line): try: Me.location = Me.location.exits["north"] except: print("You can't go north") def do_s(self, line): try: Me.location = Me.location.exits["south"] except: print("You can't go south") def …

Member Avatar for vegaseat
0
278
Member Avatar for Niloofar24

Hi again. I want to create a robot or spider or crawler with python urllib. Still couldn't find any good tutorial. Any suggestion?!

Member Avatar for vegaseat
0
421
Member Avatar for Niloofar24

Hi friends. With `datetime.datetime.now()` or `datetime.datetime.today()` i can get the current date (English calendar) for my program but what about if i want to get the current date (from Persian calendar) for my program; then what should i do? As my pc os date is set to English calendar so …

Member Avatar for Niloofar24
0
341
Member Avatar for Niloofar24

Hello. I want to learn python urllib. I have installed it and now looking for a good tutorial, any suggestion?

Member Avatar for Niloofar24
0
281

The End.