15,175 Topics
| |
Hello. I want to learn python urllib. I have installed it and now looking for a good tutorial, any suggestion? | |
Hi friends! import urllib url = 'http://www.python.org' text = urllib.urlopen(url).read() I have typed the code above on the terminal and in the next line with `print text` an html file printed there. I want to send it to a text file, how can i do that? | |
I want to exchange line 18 text with line 23 lable text, but here line 18 doesn't work in my code? Any idea?! from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label def timer(): delta = datetime.datetime(2015, 3, 21, 2, 15, 11) - datetime.datetime.now() days = delta.days … | |
Is there a specific way to code a database authentification for users of a program? | |
` #Author : Bikash Guragai #versione : 1.0 #email : bikashguragai@gmail.com or bikashguragai@programmer.net import random print ("Hello and welcome") Name = input("What is your name: ") print ("Nice to meet you",Name) ok = input("Click enter to move on") play = input("Lets play a game") b = input("Think of any Any … | |
This is a PyEditor I made because I couldn't get a IDLE working on windows 95. | |
Is it posible to have an optional veriable in a funtion? Such as this: >>>def Say(msg, (optional)): >>> print msg >>> print optional >>> >>>Say('hi', 'option') hi option >>>Say('not') not If so How? | |
import sys slayer=int(input("enter your guess for SLAYERS:")) count_letters=len(str(slayer)) if count_letters!=6: print('Your guess is incorrect: SLAYER must be a 6-digit number. ') else: new_slayer=3*slayer i=1 while(i<=1000): a=[] a=str((slayer//i)%10) i=i*10 layers=a[1]*100000+a[2]*10000+a[3]*1000+a[4]*100+a[5]*10+a[0]*1 if new_slayer==layers: print('Your guess is correct: ') print('SLAYER+SLAYER+SLAYER=',new_slayer) print('LAYERS=',layers) else: print('Your guess is incorrect: ') print('SLAYER+SLAYER+SLAYER=',new_slayer) print('LAYERS=',layers) I want to store … | |
I want to send an email using python. The contents of the message is from a sql querry placed inside a ttk treeview widget. so how do i select and send the selected items? the code below prints (I001) inside the email. # Specifying the from and to addresses self.fromaddr … | |
Hello. I have copied these 2 files of code from a website. main.py: from kivy.app import App from kivy.uix.label import Label from kivy.uix.boxlayout import BoxLayout from kivy.clock import Clock from kivy.properties import StringProperty import datetime class Counter_Timer(BoxLayout): def update(self, dt): delta = datetime.datetime(2015, 9, 13, 3, 5) - datetime.datetime.now() self.days … | |
I have a Tkinter GUI that is composed of two widgets, the first is a widget class with an entry field and a button and the second is a scrollable text widget class. I have combined these two widget classes to make a single GUI. Each of these widget classes … | |
Hi, I am looking for a little example of making a window visible or invisible. I have a main window with 2 buttons (option1 and option2). If i press option one i open a new window with something else but i want that keep stored in a variable that i … | |
Hello friends. I want to create a countdown program for the new year that is comming. I know i can use this code for example, for short certain time: from threading import Timer def sayhi(): print "hello everybody!" t = Timer(10, sayhi) t.start() But the new year begins in 29 … | |
I have code that when executed will give me a long list output, which is fine, but how can I get it to print without the parenthesis and commas? example: answer =('7', 'Q', '5', 'H', '9', '4', '3', '8', 'L') but I'd like it to print like this: 7Q5H9438L I … | |
Ok, so while practicing python, plotting and quadratic equations - I found this weird behaviour in plotting. The function 'func' defines one of the solution to a quadratic equation. The solution being *0.5(x+1 - sqrt((x+1)^2 - 4x))* And so I tried plotting this value against different x values. I get … | |
import pygal data = [ ["Python", 30.3], ["Java", 22.2], ["C++", 13], ["Ruby", 10.6], ["Javascript", 5.2], ["C#", 5], ["C", 4.1], ["PHP", 3.3], ["Perl", 1.6], ["Go", 1.5], ["Haskell", 1.2], ["Scala", 1], ["Objective-C", 0.4], ["Clojure", 0.2], ["Bash", 0.1], ["Lua", 0.04], ["TCL", 0.03] ] # Make a Pygal chart pie_chart = pygal.Pie() # add … | |
I have code that when executed will give me a long list output, which is fine, but how can I get it to print without the parenthesis and commas? example: answer =('7', 'Q', '5', 'H', '9', '4', '3', '8', 'L') but I'd like it to print like this: 7 Q … | |
The code: print [c[i] for c in ['as','df'] for i in range(len(c))] outputs: ['a','s','d','f'] while, print [c[0] for c in ['as','df']] outputs: ['a','d'] - The first letter of each word. shouldn't the output be ['a','d','s','f'] - Why is this different? | |
A simple code example on how to play wave sound files with the Python module PyGame. | |
Hey guys I have a program download link here... (link deleted) This program is used to purchase a pair of sneaker on adidas.com. I am a rookie in coding and have no idea what to do with it. I know it is a python file and you are supposed to … | |
I'm new to Python, but have a long background in Perl, Ksh &c, C, and others. """One of the different things about Python is the import statement. How do you tell where a function or class name should be imported from? Some are obvious, like sys and math, but others … | |
I'm working on a program to log the work i do as well as email the monthly log. The problem i'm having is that every time i try to test out the smtp i get an error ` Traceback (most recent call last): File "C:/Users/palmer_a/Documents/App/testy.py", line 5, in <module> import … | |
Hello. I have a list: mylist = [2,4,4] How can i take number 244 out from the list? Something like: number = 244 Here 244 is integer. | |
A simple way to find out a Python module's location on your drive. | |
I am learning python and trying to connect my satellite decoder using telnet. When I tried to connect my device through telnet python script, I could successfully connected to the device. But i want to capture/save as well as read the output and logs of device (connected thru telnet) from … | |
I started to learn python today by myself using this course: https://www.youtube.com/watch?v=bX3jvD7XFPs&list=PLB2BE3D6CA77BB8F7 Is that a good start? which book for beginners do you recommend ? *the problem with that course is that i found a lots of things in that code i do not understand i need a book which … | |
Hello again. How can i limit my list indexes? I want my list to take only 3 indexes for example. | |
Hi, me again :) Look at this error please: File "./kivycal-1", line 103, in number_two self.check() TypeError: check() takes exactly 2 arguments (1 given) The error is pointing to here: def number_two(self, event): global numbers numbers.append(2) print numbers self.check() This is a part of a class in a .py file. … | |
Here is my encryption program. The decryption program is what is giving me some trouble. Here is the description of the first part: # encrypt.py - ENCODE MESSAGE AND WRITE TO FILE # # initialize a cipher list to store the numeric value of each character # input a string … | |
Hello. mylist = [6, '/', 3, '+', 9, '+', 8, '+', 1, '/', 2] How can i delete that list indexes? I tried: def clear(self, event): global numbers for i in numbers: print i del numbers[i] But it didn't work: File "./kivycal", line 83, in clear del numbers[i] TypeError: list … |
The End.