without using decimal module:
>>> x = 2034
>>> print('%d'%(x/2))
1017
On Thu, Jul 1, 2010 at 13:56, Richard D. Moores wrote:
x = 2034
x/2
> 1017.0
print(x/2)
> 1e+15
>
> I was expecting, in fact needing, 117 or 1
ki/Prime_number
http://en.wikipedia.org/wiki/Primality_test
once you decide which algorithm you want to implement, you should be able to
get the python code in less than week's time :).
HTH.
regards,
shantanoo
___
Tutor maillist - Tutor@python.org
===
round(...)
round(number[, ndigits]) -> floating point number
Round a number to a given precision in decimal digits (default 0
digits).
This always returns a floating point number. Precision may be negative.
===
>>> round(1.23423,2)
1.23
>>> round(1.23623,2)
1.24
HTH.
On Mon, O
+++ Johan Geldenhuys [14-12-04 15:18 +0200]:
| Hi,
| I want to find out how to open a .cvs file on a remote Windows machine
| and get file to my local linux folder.
.cvs file??
|
| Any help would be appreciated.
| --
|Johan
|
| --
| This E-Mail has been scanned.
| Enjoy Your Day.
|
jyotsna guleria wrote:
Hello every one,
I am trying to parse a file:
I want to convert all the spaces in between the characters to single tab.
e.g: my file has contents like:
1G579011 10 2 0 0
0 0 0 00
5Ht-2
?
|
| Cheers
| jorge
py2exe?
Shantanoo
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ini
|
Maybe...
for x in open('_file_'):
a=x.split()
if len(a) == 1:
b = a[0]
else:
print b,
print x,
Regards,
Shantanoo
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
someone point me in the right direction?
>
> Thanks
>
> Michael
http://docs.python.org/tut/node10.html
Check section 8.3. 'Exception Handling'. You may use the example
without any modifications.
regards,
shantanoo
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
send("PONG %s\r\n" % line[1])
> <<<--->>>
>
> Thanks in advance
Instead of writing your own code for the bot, I would suggest using
supybot (http://supybot.com/).
regards,
shantanoo
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
andtimes.html' may be
useful.
regards,
shantanoo
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Dec 14, 2007 10:02 AM, chinni <[EMAIL PROTECTED]> wrote:
> Hi which editor for python on Mac os x platform is best with color syntax
> compiler etc...
You can try emacs, vim, textmate, eclipse(?)
regards,
shantanoo
___
Tutor mailli
#x27; % ( password, user, hostIP,
'/absolute/path/of/python /absolute/path/of/python/script' ) )
Also dirty method:
(i,o,e) = os.popen3('telnet hostIP)
Where,
i = input
o = output
e = error
i.write('...') for sending input.
o.readline() and e.r
="this is string"
b=1234567890
c={}
c['a'] = a
c['b'] = b
and then dump c.
Regards,
Shantanoo
pgp5hG8KxTdBW.pgp
Description: PGP signature
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
y',6,'blue'],['jhon',34,'orange'],['jeremy',1,'green'],['junita',19,'yellow']]
people = [Person(name,age,color) for name,age,color in data]
Regards,
Shantanoo
--
Eliminate guilt. Don't fiddle expenses, taxes or benefits, and don't
cheat colleagues.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
owing:
| >>> time = Time(12,34.4,00)
| >>> printTime(time)
| 12:34:0
| >>> time.seconds
| 0
instead of %d you may use %02d.
Shantanoo
--
It's not what you look at that matters, it's what you see. ~Henry David
Thoreau
___
Tut
+++ Dave S [28-09-06 16:10 +0100]:
| I currently running XP (like a fish out of water :) and I need to know the
dir
| that the python script is executed from. a linux 'pwd' How can I achieve
| this - I have looked in sys & os & os.path but found nothing suitable
Python 2.4.
+++ Shantanoo Mahajan [28-09-06 21:12 +0530]:
| +++ Dave S [28-09-06 16:10 +0100]:
| | I currently running XP (like a fish out of water :) and I need to know the
dir
| | that the python script is executed from. a linux 'pwd' How can I achieve
| | this - I have looked in sys & os
| out_put.close()
replace_words = ['TWY', 'RWY', 'WIP']
for line in in_put:
for replace_word in replace_words:
out_put.write(line.replace(replace_word,""+replace_word+""))
You can furthur reduce for loops.
Shantanoo
--
Always have an answe
>I believe sorting in place has performance advantages too.
| >
| >It's covered in the official FAQ:
| >
|
>http://www.python.org/doc/faq/general/#why-doesn-t-list-sort-return-the-sorted-list
|
| Thanks for the further enlightenment, Liam.
Maybe following is helpful:
>>
deepcopy(a)
>>> a
[2, 1, 3, 4]
>>> b
[2, 1, 3, 4]
>>> a.sort()
>>> a
[1, 2, 3, 4]
>>> b
[2, 1, 3, 4]
>>>
HTH.
regards,
shantanoo
On 18-Sep-08, at 1:00 AM, Wayne Watson wrote:
I'm using Python 2.4 in Win XP. I was surprised to find
gt; list1=['hello','hi']
>>>> list2=['a','b']
>>>>c.execute('''create table ABC(hello text,hi text)''')
>>>> list1_value= ",".join(list1)
>>>> list2_value= ",".j
://sourceforge.net/projects/pyxlwriter/
regards,
shantanoo
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
e has ONLY
lines that end in either "yes" or "no".
Any suggestions are appreciated. Also, I feel that my code is not
the best way of solving the problem even if the problem of list
indices is solved. Is my guess right?
Another suggestion. I would not read all data f
d perfectly for me.
===
$ python3.0
Python 3.0 (r30:67503, Jan 14 2009, 09:13:26)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>&
Straight forward method would be...
>>> a=[[1],[2]]
>>> b={}
>>> for x in range(len(a)):
... b[x] = a[x]
...
>>> a
[[1], [2]]
>>> b
{0: [1], 1: [2]}
>>>
regards,
shantanoo
On 21-Sep-08, at 11:36 AM, Dinesh B Vadhia wrote:
Hi! Say, I
25 matches
Mail list logo