15,181 Topics
| |
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 | |
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 … | |
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 … | |
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 … | |
Hi again. I want to create a robot or spider or crawler with python urllib. Still couldn't find any good tutorial. Any suggestion?! | |
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 … | |
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. |
The End.