On Thu, Jul 29, 2010 at 9:05 PM, Barend erasmus firstname.lastname@example.org wrote:
Can someone help me and tell why this does not work.
prys=0 tp=0 pr=0 f = open('C:\Documents and Settings\ZU1TN\Desktop\Nommers\K55.txt', 'r') pr=f.readline() prys =int(prys) tp =int(tp) pr =int(pr) tp=pr-prys f.close tp=str(tp) print tp raw_input()
Your post is off-topic for this mailinglist.
This mailinglist (python-ideas) is for proposing/discussing ideas for improving/modifying the Python language.
For general discussion and questions about using Python, please post to python-list/comp.lang.python instead. It is accessible from either: http://mail.python.org/mailman/listinfo/python-list http://groups.google.com/group/comp.lang.python/topics
Further, your question is quite vague in not stating *how* the code isn't working. You may wish to read the following guidance before posting to python-list: http://catb.org/esr/faqs/smart-questions.html
Finally, here's a less redundant version of your code with two obvious errors fixed: prys = 0 # Windows file paths either use / or \ or raw string literals f = open('C:/Documents and Settings/ZU1TN/Desktop/Nommers/K55.txt', 'r') pr = f.readline() pr = int(pr) tp = pr - prys # which simplifies to: tp = pr f.close() # you were missing the parens print tp raw_input()
Not offering cheers, Chris -- http://blog.rebertia.com