Forum: Python 20 Days Ago |
| Replies: 12 Views: 428 You'll either have to follow jlm699's advice or there's no other go, UNLESS.... unless you make a GUI for your program where this is possible... |
Forum: Python 25 Days Ago |
| Replies: 9 Views: 254 If you don't already know:
(identifier)=open("(file.txt)",'r'(or)'w')
(another_identifier)=(identifier).read()
#That's how you get text from a file which is now stored as a String in... |
Forum: Python Oct 16th, 2009 |
| Replies: 6 Views: 261 I hope pun not intended:
lol
:) |
Forum: Python Oct 15th, 2009 |
| Replies: 13 Views: 491 Try:
lucky=input("Enter a number: ")
while True:
n=lucky%10
if(n=='7'):
print(str(lucky)+" is lucky!")
return False
lucky=lucky/10 |
Forum: Python Oct 4th, 2009 |
| Replies: 5 Views: 367 If you want to check if the username is present, the easiest thing to do is:
usern=['sravan953','Dan08','SuperMetroid','vegaseat']
'SuperMetroid' in usern
"""
>> True
""" |
Forum: Python Sep 21st, 2009 |
| Replies: 14 Views: 562 Try:
nums=[]
avg=0
def main():
print "This program will average a group of numbers together"
n = input("How many numbers will you be entering?: ")
for i in range(n):
... |
Forum: Python Sep 15th, 2009 |
| Replies: 14 Views: 489 Python is a really good choice! It has a nice, clean interactive shell called IDLE. The language is also easy, for example:
print "Hello"
This gives:
I recommend you start learning it:... |
Forum: Python Sep 15th, 2009 |
| Replies: 3 Views: 372 First of all chico2009, please enclose your code in proper tags, for more on that refer to this link (http://www.daniweb.com/forums/faq.php?faq=daniweb_policies).
Now, moving onto your question,... |
Forum: Python Sep 13th, 2009 |
| Replies: 10 Views: 942 Hmmm...even I am bamboozled! I think since example="", it takes example to be null string and checks it in "Hello There" and returns True, but this doesn't:
>>> example=""
>>> "Hello There" in... |
Forum: Python Sep 13th, 2009 |
| Replies: 6 Views: 600 What woooee said was correct:
overwrite=""
while(overwrite!="Y".lower() and overwrite!="N".lower()):
overwrite=raw_input() |
Forum: Python Sep 10th, 2009 |
| Replies: 3 Views: 486 Also:
def some_function():
var="Is this a function?"
return var
var=some_function() |
Forum: Python Aug 27th, 2009 |
| Replies: 5 Views: 371 Whoa! I never knew there were so many complication in even importing modules! Kudos vegaseat! |
Forum: Python Aug 26th, 2009 |
| Replies: 5 Views: 371 I don't know what you mean by efficient, but I think
import math will suffice. |
Forum: Python Aug 21st, 2009 |
| Replies: 3 Views: 303 Yes, yes you can!
If you want to open a .txt file named: "log.txt" which is in the same directory as where you are working from:
log=open("log.txt",'r')
"""
Here, you can replace 'log' with... |
Forum: Python Aug 18th, 2009 |
| Replies: 7 Views: 290 I kinda understand your problem.
You want to print the lines(and their 'line number') containing a specific triple to another file? |
Forum: Python Aug 17th, 2009 |
| Replies: 6 Views: 416 readLines() is a type error; the 'l' is not capitals. So- readlines() |
Forum: Python Aug 15th, 2009 |
| Replies: 2 Views: 202 I have no idea why it doesn't work, but this works:
talking="quit"
talking=="q" or "quit"
#True |
Forum: Python Aug 15th, 2009 |
| Replies: 6 Views: 416 Zebibyte's code idea is correct, although lines 5 & 6 are unnecessary(I think). |
Forum: Python Aug 10th, 2009 |
| Replies: 5 Views: 450 This worked for me:
>>> s = '491 43140113108107 11210'
>>> a=0
>>> b=3
>>> for x in s:
s1=s[a:b]
print(s1)
a+=3 |
Forum: Python Aug 8th, 2009 |
| Replies: 7 Views: 531 Yeah I probably think so, because I too couldn't get onto the site!
P.S: Maybe python.org was also a victim of a DoS attack joining the leagues of Twitter, LiveJournal and Facebook? |
Forum: Python Jul 31st, 2009 |
| Replies: 4 Views: 325 Just for my confirmation, try this if it works:
import subprocess
subprocess.call(["flash.exe",the location of the file]) |
Forum: Python Jul 22nd, 2009 |
| Replies: 5 Views: 309 If length of the last few characters(_0c12d) aren't going to change, you can try this:
det_file = "/grups.google.com/grup/cmp.lng.pythn/browse_thread/thread/8_ee63e_17del_0c12d"
le=len(det_file)... |
Forum: Python Jul 17th, 2009 |
| Replies: 4 Views: 328 Hey, I too was totally confused by your problem, it happened to me too! But, I tried this:
>>> mylist = ['bunnies', 'apples', 'animals', 'fruit', 'amsterdam']
>>> for x in mylist:
print... |
Forum: Python Jul 14th, 2009 |
| Replies: 7 Views: 716 Mine works too, I tested it! ;) |
Forum: Python Jul 14th, 2009 |
| Replies: 11 Views: 568 Try:
infoToWrite = "Harry Potter: Teenage boy who has an owl"
myFile = open("characterlist.txt", "r")
myFile.write(infoToWrite)
It should work, I only removed the 'plus'(+) after the r in... |
Forum: Python Jul 14th, 2009 |
| Replies: 7 Views: 716 Try:
import time
response=raw_input("Are you ready?\n")
while(response.lower()!="no"):
if(response.lower()!="yes"):
time.sleep(3)
response=raw_input("\nAre you... |
Forum: Python Jul 13th, 2009 |
| Replies: 5 Views: 672 Try:
log=open('1234txt','r')
log_read=log.readlines()
x=""
for a in log_read:
if (a=='you love me'):
x="True" |
Forum: Python Jul 4th, 2009 |
| Replies: 5 Views: 314 To assign values:
loop=[]
#Depending on number of values you want to assign, specify the limit(here 5 values)
a=0
while a<=5:
loop.append(a)
a+=1 |
Forum: Python Jun 28th, 2009 |
| Replies: 17 Views: 788 @Vegaseat: I think it would take you only few days! :D |