No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
16 Posted Topics
alright so my exact problem is that when I attempt to visit a url stored in a text file I get the error "URLError: <urlopen error no host given>" This is strange because if I type in the urls myself they work fine(opener.open("site.com")) The lines of code causing the error … | |
Re: Read what Zed Shaw says in the book. He explains that an octothorp is a # sign. And a script is any program that you write. I hope that this helps you and also if you mean to make a new line like the same way as pressing enter just … | |
Re: It works fine for me. Here is the code I have been using. [CODE] def main(): print "This program calculates fuel efficiency over a multi-leg journey." print "You should enter the gallons of gas consumes and miles traveled" print "for each leg. Just hit <Enter> to signal the end of … | |
Alright so I was not sure exactly how to say this, but here is the idea. I have a graph or table I guess you could call that looks like this. [CODE] print ''' ----------------------------- | | | |x | | | |----------------------------- ''' [/CODE] Then I want to make … | |
Re: Also another thing to note is that with python 2.x you should not use input at all as it actually calls the eval() function which can give your problems with certain numbers so use [CODE] int(raw_input()) [/CODE] | |
Re: Could you post the source code so we can better understand your question? remember to incase it in a code-block and such | |
I want to be able to generate my own random numbers without using the random module. I want to do this that way I can learn somewhat how to do the big boy code on my own. | |
Re: like pyTony said you want to use the webbrowser module. where pass is in your could it would look something like this [code=Python]#after you have imported webbrower webbrowser.open('address to site goes here') [/code] | |
How would I find the amount of characters in a string and then use that to print a certain amount of some character that you choose. For example: [CODE=Python] a = 'string' # this holds 6 characters print '*' * # amount of characters in string [/CODE] | |
Re: python is an interpreted language and like most languages you can use it to do many things. Also because python is coded in C and most cell phone apps are coded in some sort of C based language it is possible to make an app in python. | |
The title really says it all. For example if I had a music file and I wanted to have it play all the way through then how would I make it start another music file after the first is done? | |
Re: you need the code to print out the html not just the words so instead of print"location blah blah" you need to do print"<html><head><title></title></head><body><p>Location blah blah</p></body</html>" | |
Re: This is the easiest way I know. [CODE] import os os.startfile(r"%windir%\system32\cmd.exe") [/CODE] | |
Re: If you would like to open any program including cmd or if you want to execute code in the cmd using python you must look into the os module. [CODE=python] import os os.startfile(r"program location in computer") # the 'r' before the string changes how \ are used os.system("command") # this … | |
Re: Here this will help you. [code=python] if row['username'] == 'mutango': if row['password'] == 'muta55': print "okay" sys.exit(0) else: print "Wrong" [/code] | |
Re: Everyone is making this way to complicated here is the program working in whole with a list it will do everything you want and is simple. [code=python]def average(li): total = 0 i = 0 while (i < len(li)): total += i i += 1 print i t = ['1', '2', … |
The End.