15,185 Topics
| |
I am trying (first python attempt) to pull information from a web page and store is for further use. Here is the code that opens the page and gets the information. [CODE] # -*- coding: utf-8 -*- #python from urllib import urlopen myfile = urlopen('http://192.168.0.1/stlui/user/allowance_request.html%20target=%22allowance%22').read() print myfile [/CODE] The following … | |
Hi, I'm trying to make a frontend for the compile module in python. Everything works just right, except when the file has mistakes in the code that lead to a syntax error. It does raise the invalid syntax error in the terminal, but instead of executing the block inside the … | |
Hi all, in a python script file, I am having a open statement and then i write a "50000" to that file. And then within the script i am writing a scp command that transfers the file to a remote machine. In the local machine if i check the file … | |
| hello everybody! I have a main app, which imports another python file and uses its functions. my problem is now, that the external file itself needs some functions defined in the main app... if i copy the external files code and paste it into the main application, everything works fine, … |
Hi I writing a Python program to track and calculate the amount of money each of 8 customers spends on 12 grocery items. The code below works fine but The program also must congratulate the customer who spends the most money and offer that customer a $50 shopping spree.How can … | |
hi all, i need to get all the data in the list (which is posted in the form) and store it, separating each list item with comma's. Its really clear in the code...this is what ive tried so far..it doesnt compile and it seems to complain about this line of … | |
I would like to be able to create a list of all instances of a class. [URL="http://www.daniweb.com/forums/thread131805.html"]Another post[/URL] here described how to do it by appending to a list during the __init__ routine but since I am a real Python newbie (and even more of a newbie to classes) I … | |
Let Python do the work for you and figure out the roman numerals for a given integer. I have to ask you to keep the integer values somewhat reasonably low (from 1 to 4999), since roman numerals from 5000 on use characters with an overline and most PCs don't have … | |
I am calling: c = Counter() ...exactly as in the collections example code here: [url]http://docs.python.org/py3k/library/collections.html?highlight=collections#collections.Counter[/url] but it gives me this error: NameError: name 'Counter' is not defined Anyone know why? Note that I have 3.1.2 and yes I include "import collections". Thanks | |
[I]Now, I may have bitten off a bit more than I can chew with this promised program for my pops, but I am confident, with time, I can puzzle out a solution with some help! Background Info: My father is a doctor responsible for monthly schedules, usually penciled painstakingly on … | |
Hi, I have a very simple problem yet I can't find out how to do it for the life of me. I am creating a simple CGI script with Python and part of it needs a HTML form. This is what I have so far (excludes imports, etc): [code=python]font_size = … | |
Thus far, installing and getting Python 2.6 running properly on x64 Windows 7 has managed to be a fat pain in the butt. Latest in my saga of silliness, is that the PyDoc server doesn't run properly. Initially, I was getting "pydoc is not recognized as an internal or blah … | |
I have a series of files similar to that 1A2B_A.txt, 1A2B_2C.txt, 1A2B_DF.txt, 1B23_D.txt, 1B23_B.txt, 1B23_25.txt, and many more I want to combine each three files starting with the same four code before the "_" Thanks in advance | |
I am working on the folowing code, which basically counts every letter in a given text. I want to store the numbers in letter names: A=1 B=3 and so on... I guess it stores the number underthe name 'letter', but not under the corresponding letter 'A'. It would be great … | |
Hi guys ! I am willing to ask you if you could think of a py script that loads a text file and just joins the data contained in there following this example This could be an input: ssms smsmsms sksksskkks ppppplkl ndndndnd kdkdkdkdkppp And this an ouput: ssmssmsmsms sksksskkksppppplkl … | |
Hallo everyone at DaniWeb :) A made a mail script, that i need to somehow break, to close the connection to the gmail server securely. Can someone give me a hint, what to do for that. [CODE] import smtplib import urllib2 import time def sendIP(): # fetch pub ip pub_ip … | |
How do you make Python distinguish from files and folders if they are dragged and dropped into the program's window? [CODE] import os import string newDrag = raw_input("Drag and drop the file or folder you want to add.\n") newStrip = newDrag.strip('"') #Removes the quotes Windows randomly adds for some reason … | |
What's Up? OK, So I've been scripting (Some what) my first Python project, Host.py & Guest.py: Host.py listens for sockets connections on your computer, While Guest.py connects to Host.py and sends some text. Now yesterday a light bulb appeared above my head & I instantly got a thought ''What If … | |
Hi, i was wondering if someone could help me out here. from the below code i get the following error "TclError: couldn't open "H:\SDD12\Images oses.gif": no such file or directory" but i dont understand why the r is vanishing from the filename... [CODE] root = tk.Tk() root.title('background image') # pick … | |
Hi all , I got two questions : How to convert the time of a message from "127558161.23" to 03/06/2010 12:42pm ? When I receive a message and I want to know the number of the sender so I can resend him a message it returns me his name - … | |
hi I have a problem with the following code ... [B][COLOR="Blue"]>>> j = win32pipe.popen('c:\\disk\\plink jnitin@10.94.101.178 -pw mat123 df -g','r') >>> for i in j: print i >>>[/COLOR][/B] As you can see the file object 'j' does not have anything in it... But if I type [COLOR="Purple"]'c:\disk\plink jnitin@10.94.101.178 -pw ibm123 df … | |
i want to use input validation so that the user can only input decimal numbers. can someone help [CODE] while int_x != : #this is where im having the problem print "the number entered must be a decimal number" int_x = input("Enter a decimal number:") [/CODE] | |
Hello! I am trying to display a FITS image, if your not familiar with the extension its fine (gtk.Image.new_from_file() isn't either). I can get my image data to a numpy array (2D (256x256 to be exact)) I am having the most difficult time getting this into a grayscale image. I've … | |
Hey all, I've been experimenting with a basic chat server/client from my Python textbook, in efforts to keep the code clean and simple I think some optional code was omitted and it's made the books example a little buggy. I've been having troubles with the line: [CODE]transmission = self.request.recv(1024)[/CODE] This … | |
Here is solution number one for one word anagrams, I gave in discussion thread, response time in my humble Athlon PC under 70 ms. List of words is from original posting of the discussion thread. [url]http://www.daniweb.com/forums/post1206616.html#post1206616[/url] This version does not give we'd for input dew. Next time I give final … | |
Hi, I have been using a Python script to launch various applications but have run into a problem when trying to build some resiliency into it. A second script i created waits and checks for a certain window title to take focus and then clicks on the OK button if … | |
Can i put a flash aplication in on my program on python? | |
[CODE]def save_transaction(price, credit_card, description): file = open("transactions.txt", "a") # the "a" means you are always going to append to this file file.write("%s%07d%s\n" % (credit_card, price, description)) file.close() items = ["DONUT", "LATTE", "FILTER", "MUFFIN"] prices = [1.50, 2.0, 1.80, 1.20] running = True while running: option = 1 for choice in … | |
What's Up? OK, So my first Python script is still underway, Once a computer connects to the first script, we can then start sending text between them using a nice simple easygui. However after sending your specifed text once, It won't come back and ask you again. [code]#!/usr/bin/python import socket … | |
Hi I'm using python 3.1 and Windows. My program writes xml code to a text file, the problem is that windows needs to know that this file's encoding is utf-8. Right now it does write the proper code, but other programs (firefox, for instance) fail to read it because it … |
The End.