I am new to programming and am using Allen Downey's How to Think Like a
Programmer, 2nd Edition Python edition to start learning. I am having trouble
viewing the pydoc graphic on a local host. I know this is not necessarily a
Python question, but I would appreciate any advice that can be prov
"Steven D'Aprano" wrote
File "C:\Python27\Foursoft\calendar.py", line 33, in
What's "Foursoft"?
I would say that the standard library calendar module is being
shadowed
Ah, good catch. I didn't notice the path was non standard.
Alan G
___
ranjan das wrote:
This is a small example i created
from operator import itemgetter
temp={'4':(2,3), '2':(5,8)}
print temp.items()
new_temp=sorted(temp.items(), key=itemgetter(1)
print new_temp
Another syntax error. Please ensure that you test your code before
posting. In this case, it's eas
Modulok wrote:
Notice that 'd' in your string substitution means integers, not
floats. Any decimal places will be truncated when using 'd'. For
floats use 'f' instead. You an also specify a precision, such as
'%.2f' shows two decimal places.
However, to make all of your numbers line up nicely,
This is a small example i created
from operator import itemgetter
temp={'4':(2,3), '2':(5,8)}
print temp.items()
new_temp=sorted(temp.items(), key=itemgetter(1)
print new_temp
I want to sort the dictionary by the value in the first element of the tuple
((2,3) and (5,8)) and then the second
Alan Gauld wrote:
"ranjan das" wrote
Error:
Traceback (most recent call last):
File "C:\Python27\Foursoft\calendar.py", line 33, in
while friday.weekday() != calendar.FRIDAY:
AttributeError: 'module' object has no attribute 'FRIDAY'
The obvious solution is that calendar has changed be
ranjan das wrote:
I ran the following code in python 2.6 and then in python 2.7 (using
calendar module) to manipulate dates and times
The following code works fine in Python 2.6 but throws up an error in Python
2.7. Can anyone please say why?
No it does not work fine at all. It generates a Syn
"ranjan das" wrote
The following code works fine in Python 2.6 but throws up an error
in Python
2.7. Can anyone please say why?
import datetime
import calendar
while monday.weekday() != calendar.MONDAY:
where does 'monday' come from?
Can you send a minimal example that could actually run
"Modulok" wrote
However, to make all of your numbers line up nicely, regardless of
how
long they are, you need to look into advanced string formatting via
the builtin string method 'format()'. It takes a little practice
Or, if your version of Python doesn't support string.format() (pre
2.6
"michael scott" wrote
...if something about my code could be better, please tell me,
OK, Here are some stylistic things...
def production_time():
creation_time = 127
time_till_rest = 18161
I'd move the constants out of the function to global level.
And it is convention to make const
Hi,
I would go for appending sys.path. This is a simple way to do it, and
perhaps not even needed for each python file (only files which use the
modules that you have installed))
Another way to do it is adding the modules you need to sys.modules manually.
2011/3/5 Modulok
> List,
>
> Backgroun
11 matches
Mail list logo