- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 16
- Posts with Upvotes
- 13
- Upvoting Members
- 11
- Downvotes Received
- 5
- Posts with Downvotes
- 4
- Downvoting Members
- 4
Re:
1)Create a list of the odd numbers between 1 and n (include 1 as well as n -- if it's odd-- in the list). Associate the list with the variable odds . 2)Given the list my_list containing integers, create a list consisting of all the even elements of my_list . … |
|
Re:
I've skimmed the manual and cant find the answer to this anywhere: In basic, to add an Input function you would do (for example): [CODE] Input "What is your name? " name$ [/CODE] How do I do this in Python? |
|
Re:
I am a total newbie to programming. I was hoping to learn how to write a program that prints out a string representation of a random card from a deck of playing cards. The programs should use either “A”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”, “J”, “Q”, … |
|
Re:
I'm working on a cleanup script for tv shows that I download. Right now I'm just looking for a file greater than 50mb, but there should be a better way. [CODE] import os import shutil dir = "C:\Users\Bobe\Downloads\TV\\" for folder in os.listdir(dir): if os.path.isdir(os.path.join(dir,folder)): for file in os.listdir(dir + folder): … |
|
Re:
Is it possible to keep writing the output of a program on the same line instead of moving to a new line every time? The output should be written over the preceding output. An example would be a kind of counter... say a number that counts from 1 to 10 … |
|
Re:
Hi I'm having a test suite in python and i would like to email the result through my company server. I used a similar code but the code seems to be hung while waiting for a response from server during socket.connect() call. I traced the code and found that it … |
|
Re:
In the following program, I have three different comments each after a line of code. Please read those comments to answer my questions. [CODE] # Property Critter # Demonstrates get and set methods and properties class Critter(object): """A virtual pet""" def __init__(self, name): print "A new critter has been born!" … |
|
For those of you that are familiar with wx... I'm just dipping my toe into the world of wxPython and I've been trying to put together a very simple Wizard app. Right now I have code that is working properly, but I'd like to know how I can change the … |
|
Re:
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 … |
|
Re:
[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 … |
|
Re:
Its not running [CODE]import math import os cls = os.system("cls") title = os.system("title Pythagorean Theorum Solver") def MainLoop(): cls print "Enter 3 coordinate plane points (x - y) format" print "" firstPair = input("--> ") SecondPair = input("--> ") MathPart() def MathPart(): '''structure of the formula: squareRoot of --> (x-y)^2 … |
|
|
Re:
Hi again, I'm now working on a twitter client and I'm wondering how people update their programs when it needs it, for example when I commit a change. Any help on the subject would be most appreciated thanks |
Re:
28 Minutes Ago | Add Reputation Comment | Flag Bad Post One last problem with my script, it returns this error message... [CODE]Traceback (most recent call last): File "C:/Python26/Renamer 3", line 23, in <module> os.rename(fname, b)WindowsError: [Error 2] The system cannot find the file specified.Traceback (most recent call last): File … |
|
Re:
Just like in the title, instead of renaming the files in the "target folder" it just renames all possible files in the python directory, and im not sure how to fix it, although this is my best attempt. [CODE] #!usr/local/bin/python import re, os from os.path import join as pjoin targetfolder … |
|
I have some processes that I need to keep running on a linux host. For some reason the processes are dying (possibly being killed by another admin). I can hunt that down later, right now I need to make sure the processes are running and relaunch them if necessary Launching … |
|
Re:
In the following program, at what point does my program call the _str__ method/constructor? I don't see it specifically being called at any point. I know it happens with this line print [CODE]"Printing crit1:" print crit1[/CODE] but I still don't see how or when this happens. Thanks for any and … |
|
|
Re:
What do you mean by: "but I don't know how to add something to the dictionary while the program is running"? |
Re:
Does anyone use Python on a Windows7 machine? What is your experience? Does it work well? I am thinking about getting a new computer and also start some Python programming. |
|
Re:
I'M reading the book "Python Programing second edition for the absolute beginner". While explaining the object paramater whithin a class, this how it reads. Base your class on [I]object[/I] , a fundamental, built-in type. Can someone please tell me what that means? Thanks. |
|
Re:
Hi, I wrote this sample code to check the integrity of an IBAN (International Bank Account Number) bank account number. (See Wikipedia for further information) Any advice to simplify this? [code=python] # # IBAN_Check.py # Utility to check the integrity of an IBAN bank account No. # Python 2.5.1 # … |
|
Re:
I wrote my own sha implementations but i cant get them to read files correctly. i know to use [CODE]open(file,'rb').read()[/CODE] as the input into the algorithm, but [CODE]import hashlib hashlib.sha1(open(file,'rb').read()).hexdigest()[/CODE] and my code [CODE]sha_1(open(file,'rb').read())[/CODE] return two different hashes. any idea why? i know that a normal string will have the … |
|
Re:
I want use MD5 to compare both folder in Python. Following steps that i want to compare both folder by using MD5: 1. After all the files downloaded to folderA. 2. All the files inside folderA will copy to folderB. 3. Then MD5 will compare both folder is correct hash. … |
|
Re:
I have written a script for scraping a web site, and it works fine. What does not work fine, is when I try to use the write function, to write the results to a txt-file. I am trying to run this: import BeautifulSoup, urllib2, re, time import codecs path='C:/Users/Me/Documents/Python' outfile=open(r'C:/Users/Steinar/Documents/Python/Vegvesen/vegresultat.txt', … |
|
Re:
Hello everyone, I'm learning Python and I have a few questions about Dictionaries and sorting them by a value other than the key. Lets say, for example, I have a Dictionary full of data that needs to be sorted on the 3rd value instead of the key. How would I … |
|
Re:
I am currently reading two books, one on PHP and one on Python. Not that I'M good at ether. I'M about half way through the book on PHP or less and almost done with the one on Python. Though I haven't actually read anything web related in this particular Python … |
|
Re:
I'm just wondering what do I have to add to the code [code] print "Hello World" [/code] to output H e l l o W o r l d like there's spaces in between each letter? Thanks. |
|
Re:
Assume I have a file of the following format: a,1 b,2 c,3 d,4 Here is my code: [CODE]def junk(f): d1 = {} d2 = {} for line in f: columns = line.split(",") letters = columns[0] numbers = columns[1] d1[letters] = numbers d2[numbers] = letters return (d1, d2) def something(): print … |
|
Re:
I have to get pthagaros to get the distance between 2 points. so the function distanceBetweenPoints(Point(1, 2), Point(4, 6)) should result in 5.0. the parameters are supposed to be P1, P2, which i think i have done?. The get an error when i try to execute this?.. help please def … |
|
Re:
Hi everyone, I'm trying to write some code for this question. I believe I have the right answer but it says it isn't. Anyways here is the question. 1) Given that dict1 refers to a dictionary, change the value mapped to by the key 'Boo' to 'Hoo' . My code … |
|
Re:
how to check if the string is pallindrome or not in python?? |