#python - Sat 21 Apr 2007 between 14:10 and 14:23

NY Lost Funds



MoHaXthx
Peperhello
any way to "dereference" a path with symlinks?
bytecoloros.path.realpath?
Peperthanks
thefirstdudewhat's the best way to add a zero to a string if it is only 1 char long
SpCombnot chatting as root
thefirstdude: you want to format numbers or something else?
thefirstdudeI just want if a string is less than 2 long make it 2 long by adding 0's in front
SpComblet me guess, is this string a number?
thefirstdudeor an arbitrary number
neither, either
string preferably
I know I can do if len(string): string = '0' + string...
but is there no better way?
plastic_wrapi am having some difficuly raising custom exceptions in python 2.4. ClassA inherits Exception, classB inherits class A. I f I call raise ClassB, the __init__ method throws an error when it tries to call super(ClassB, self)__init__. the error is argument 1 must be type, not classobj
stepzstring = max(0,2-len(string))*'0' + string
SpCombif it's a number, "%02d" % (your number)
thefirstdudethanks stepz
SpCombseems you can't pad strings with anything but spaces
Adri2000how can I catch more than one line with sys.stdin.readline() ?
plastic_wraplast time to fix this error i had to change the class to inherit from object.... but if i do that then i cant call raise ClassB as its not inheriting from Exception
^alienis there anything like PHP's explode in python?
stepzhmm, the max isn't even necessary
JafetThe split member.
SpCombplastic_wrap: inherit A from both Exception and object?
bytecolor^alien, christ I hope not ;)
Jafetre also provides regular expression splitting I think
stepznegative_number * string == ''
mmiikkee12can anyone explain what's going on here? >> http://pastebin.ca/451507
SpCombmmiikkee12: int/int = int
mmiikkee12SpComb: oh, i see. 119/200 = 0... so why is it letting me divide by 0?
stepzthis will be changed, you can do from __future__ import division to get expected behaviour
SpCombmmiikkee12: multiply by zero?
mmiikkee12oh.
never mind :)
plastic_wrapSpComb: good call, i tried that, didnt work. i get exceptions must be classes, instances, or strings (deprecated), not ClassB
mmiikkee12SpComb: thanks
SpCombplastic_wrap: what does ClassB inherit from, exactly? class ClassB (ClassA) : ?
plastic_wrapSpComb: yep

Page: 5 12 19 26 33 40 47 54 61 

IrcArchive

NY Lost Funds