15,175 Topics

Member Avatar for
Member Avatar for lewashby

In the following code, could someone please explain these if statements? elif 5 <= unhappiness <= 10:, & elif 11 <= unhappiness <15:, they have two arguments, one on each side which is something I haven't seen before. Also, what the one to the far right for anyway? Also, this …

Member Avatar for masterofpuppets
0
151
Member Avatar for kaydub123

I need to write: Starting weight of food (in lbs:ozs)=8:9 into a python 3.0, I'm very new to this and what I came up with was: Starting_weight_of_food_in_lbs{:}ozs=input("Enter Starting_weight_of_food_in_lbs{:}ozs") print("Starting_weight_of_food_in_lbs{:}ozs entered=", Starting_weight_of_food_in_lbs{:}ozs) and I belive i'm way off....any help would be great!

Member Avatar for masterofpuppets
0
133
Member Avatar for Gribouillis

Joining together ordered sample points (xi, yi) when ths xi's are different yields a piecewise linear continuous (P1) function. This snippet defines a handy class to manipulate these functions. It allows computing the value and the slope of the function at each point, arithmetic operations, absolute value, truncation and linear …

Member Avatar for Gribouillis
1
594
Member Avatar for rajeshwari_ib
Member Avatar for patriciuuu

I'm trying to make a SMTP Checker using Python. The checker will do the following things: The code will take a list of smtps accounts (ex: host,user,pass) and will try to send an email to a email you will specify in the code. If it's successful (the send of the …

Member Avatar for nure
0
381
Member Avatar for vegaseat

This program uses the Python win32 extension module to get information on disk or flash drives for Windows machines. Specify the drive with its letter. If no drive letter is specified, the current drive is applied.

Member Avatar for Gribouillis
4
3K
Member Avatar for NicholasE

Hi all, I would like to make a for loop in which should do the following: To print the string n[i] twenty times then the string s[i] only one time. Then leave a gap and continue this until the n reaches n599 and s goes to s30. n0 n1 n2 …

Member Avatar for NicholasE
-1
86
Member Avatar for AutoPython

I have a limit of 30-45 dollars to buy an editor (with Python support, obviously) . Here's what I would like. Customizable syntax highlighting (like the kind in Notepad++). Auto indent, so it autmatically indents 4 spaces after a ':' character. Good code completetion. A built in IDE. Preferably like …

Member Avatar for Gribouillis
0
169
Member Avatar for smohrchi

I've been working with Java for several years now and it's time for me to expand to other languages. I've decided to learn Python and have now just started looking into where to begin. I'm wondering if there is one, maybe two books out there that are considered to be …

Member Avatar for jaux
0
90
Member Avatar for baskar007

I have a list of part files (that is many parts of single file). I want to append all parts into a single file to make a full file. I used this code: [CODE] import os l = ["home/baskar/1.part","home/baskar/2.part","home/baskar/3.part"] source_file ="/home/baskar/source.file" re_size = 0 buffer = 10*1024 #10 KiB's for …

Member Avatar for Archenemie
0
183
Member Avatar for deonis

Hello I'm trying to add highlighting to the specific keywords in the text widget. For instance I would like to highlight : Hello World. where is "hello" - will be coloured in red and "World" coloured green. Any Idea ??? [CODE] from Tkinter import * import os import subprocess import …

Member Avatar for deonis
0
3K
Member Avatar for katharnakh

im confused with [I]__call__() [/I] method defined within the class. [I]__init__() [/I] is used as constructor, and is called when we create an instance of the object. when does [I]__call__() [/I] method get called even though we not specify it explicitly... please help..........

Member Avatar for snippsat
0
17K
Member Avatar for checker

This is what I intended to do [CODE] class person: "class to represent a person" def _init_(self): self.name = "" self.age = 0.0 self.sqr_age = 0 class ageName: def listAgeName(x,y): # x is name # y is age x = 0 y = 0 listAgeName = [('John', 18)] p = …

Member Avatar for fallopiano
0
121
Member Avatar for johnroach1985

Hi there! I new learner in Python. And just couldn't get threading. I wrote this script. [CODE] import sys import MySQLdb if len(sys.argv)!=3: """the program name, mac and ip makes three""" """stop program and send error""" sys.exit("Must provide mac and ip!") mac = sys.argv[1] ip = sys.argv[2] print 'Connected to …

Member Avatar for woooee
0
286
Member Avatar for sjgriffiths

hello I am inserting records into a MYSQL table via a loop Records are being inserted, but every now and then the program bombs out with the below message There is nothing wrong with the query line though (If i restart the job, this record will be inserted without issue) …

Member Avatar for woooee
0
176
Member Avatar for vnproduktionz

[code] Program to make snowflake! # Local graphics module. Must be in same folder as this # program (or both on Desktop) import ecs10graphics as gr # Math module that comes with Python import math def pointOnCircle(f, r): # f is fraction of the way around # r is radius …

Member Avatar for vegaseat
0
92
Member Avatar for NicholasE

Dear All, I am opening a file called initialisation: [CODE]try: initFile = open("initialisation.dat", "r") except IOError: print ("Initialisation file cannot be openned for reading")[/CODE] I would like to read the contents of this file and then print them on several other files i.e. file1, file2, file3, file4, etc. i am …

Member Avatar for Gribouillis
0
121
Member Avatar for lenfranc

I am a newbie just getting started with Python. I have trouble understanding the statement "The __init__.py files are required to make Python treat the directories as containing packages; this is done to prevent directories with a common name, such as string, from unintentionally hiding valid modules that occur later …

Member Avatar for lenfranc
0
155
Member Avatar for Aiban

Hello I wondered if anyone had an idea on a piece of code that could tell me the available free disk space. There is a trick here, otherwise this easy question wouldn't be here. I need the free disk space to read off where the program is being run, and …

Member Avatar for Stefano Mtangoo
0
256
Member Avatar for truekid

-------------------------------------------------------------------------------- So i just realized after checking my emial that i have a python hw for my comp sci class due tom night at 12am . I read the hw and i am a bit lost. I will be starting it tonight once i get out of work. The task …

Member Avatar for sneekula
0
101
Member Avatar for gangster88

i am a bit stuck on this, i need to call the first 2 functions for the output in the 3rd one. The user has to should be able to continue until they want to stop converting and they should be asked on which way the conversion is to be …

Member Avatar for sneekula
0
587
Member Avatar for Musafir

[CODE]def main1(f): return (f - 32) * 5.0 / 9.0 def main2(c): return 9.0 / 5.0 * c + 32[/CODE] the two function above convert fahrenheit and celsius I have to write a third function which calls the two functions above and allows the user to input to convert between …

Member Avatar for sneekula
0
390
Member Avatar for Tech B

I want to read two points in a picture. Most pixel values will be (0,0,0). I don't know how to take the flatted data and separate it into x,y coordinates. I use the Image library and VideoCaputre.

Member Avatar for fallopiano
0
513
Member Avatar for Prahaai

Good day. I would need an advice about sys.stdout and sys.stderr. I use Python 2.6, on Windows XP SP3, but i think the question is the same for UNIX/ MAC computers. I tried all possible combinations before posting this message, so ANY advice would be great. I work with "subprocess" …

Member Avatar for Gribouillis
0
343
Member Avatar for Garee

Hey guys I have a wee problem I need some help with. How would I read in lines of text one at a time, keeping track of the line numbers, only stopping when a line is read that contains only a single full-stop. Example: It is a briskly blowing wind …

Member Avatar for masterofpuppets
0
102
Member Avatar for biotic.computer

Hi everybody :) i opened a freshly new blog about python and simulation in bioinformatics and i started by programming a DNA Replication,Transcription andTranslation simulator with very simple python commands so is there any improvement to the code source? the Vpython is needed for graphs the blog:[URL="http://bioticcomputer.blogspot.com/"]http://bioticcomputer.blogspot.com/[/URL] the code source:[URL="http://www.slingfile.com/file/ENAI9lK4FM"]http://www.slingfile.com/file/ENAI9lK4FM[/URL] …

Member Avatar for Gribouillis
0
107
Member Avatar for marcux

Hi all! I want to make a subclass of dict and I have read about subclassing and the super method. The problem that I do not get is how I override the following method: [CODE]dict[key] = value[/CODE] This creates a new key with the specified value. I want to override …

Member Avatar for Gribouillis
0
185
Member Avatar for sneekula

I was trying to create a 3x3 list of lists, and came up with this surprising behaviour: [code]# creating a 2D list with an overloaded * operator mlist3 = [[0]*3]*3 print mlist3 # [[0, 0, 0], [0, 0, 0], [0, 0, 0]] mlist3[0][0] = 1 print mlist3 # [[1, 0, …

Member Avatar for Mathhax0r
0
1K
Member Avatar for Musafir

i have to write a program that simulates the flipping of a coin. 1. the function should ask the user how many times the coin should be flipped 2. the program should display the poportion of times that the head and tails appeared. (for example if the user enters 10 …

Member Avatar for vegaseat
0
138
Member Avatar for SoulMazer

Okay, so I am writing a media player and I would like to be able to control the entire thing without the use of a GUI. So...are there any libraries or anything that would allow me to collect keystrokes on any OS (not just Windows)? Thanks in advance.

Member Avatar for Tech B
0
229

The End.