No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
I have a folder with 40 files in it which I want to loop through. When I print out the name of the file my code works fine: import os source = 'pathtofile' for root, dirs, filenames in os.walk(source): for file in filenames: print file It will print : File1 … |
|
Hi, I am fairly new to Python. I am familiar with the concept to pass data accross functions. In theory, def c(): r = raw_input("Ask Something? ") .. return r def p(x): ... do something r = c() p(r) The code below works just fine via Terminal ( python filename.py … |
|
Hi, I'm newbie in Python Programming. I created the below code. I want to optimize it, but dont know where to start. I am sure, I can do the same with less lines of code. Please advise on best practices and ways on how to optimize it. import math def … |